comparison Lib/IMPL/Object/Autofill.pm @ 275:6253872024a4

*refactoring IMPL::Class
author cin
date Thu, 31 Jan 2013 02:18:31 +0400
parents 47f77e6409f7
children 4ddb27ff4a0b
comparison
equal deleted inserted replaced
274:8d36073411b1 275:6253872024a4
52 52
53 53
54 if ($class->can('get_meta')) { 54 if ($class->can('get_meta')) {
55 # meta supported 55 # meta supported
56 foreach my $prop_info (grep { 56 foreach my $prop_info (grep {
57 my $mutators = $_->Mutators; 57 my $mutators = $_->mutators;
58 ref $mutators ? (exists $mutators->{set}) : ($mutators & prop_set || $_->Implementor->isa('IMPL::Class::Property::Direct')); 58 ref $mutators ? (exists $mutators->{set}) : ($mutators & prop_set || $_->implementor->isa('IMPL::Class::Property::Direct'));
59 } $class->get_meta('IMPL::Class::PropertyInfo')) { 59 } $class->get_meta('IMPL::Class::PropertyInfo')) {
60 my $name = $prop_info->Name; 60 my $name = $prop_info->name;
61 if (ref $prop_info->Mutators || !$prop_info->Implementor->isa('IMPL::Class::Property::Direct')) { 61 if (ref $prop_info->mutators || !$prop_info->implementor->isa('IMPL::Class::Property::Direct')) {
62 $text .= " \$this->$name(\$fields->{$name}) if exists \$fields->{$name};\n"; 62 $text .= " \$this->$name(\$fields->{$name}) if exists \$fields->{$name};\n";
63 } else { 63 } else {
64 my $fld = $prop_info->Implementor->FieldName($prop_info); 64 my $fld = $prop_info->implementor->FieldName($prop_info);
65 if ($prop_info->Mutators & prop_list) { 65 if ($prop_info->mutators & prop_list) {
66 $text .= " \$this->{$fld} = IMPL::Object::List->new ( ref \$fields->{$name} ? \$fields->{$name} : [\$fields->{$name}] ) if exists \$fields->{$name};\n"; 66 $text .= " \$this->{$fld} = IMPL::Object::List->new ( ref \$fields->{$name} ? \$fields->{$name} : [\$fields->{$name}] ) if exists \$fields->{$name};\n";
67 } else { 67 } else {
68 $text .= " \$this->{$fld} = \$fields->{$name} if exists \$fields->{$name};\n"; 68 $text .= " \$this->{$fld} = \$fields->{$name} if exists \$fields->{$name};\n";
69 } 69 }
70 } 70 }