Mercurial > pub > Impl
comparison Lib/IMPL/Class/PropertyInfo.pm @ 275:6253872024a4
*refactoring IMPL::Class
| author | cin |
|---|---|
| date | Thu, 31 Jan 2013 02:18:31 +0400 |
| parents | 8d36073411b1 |
| children | 4ddb27ff4a0b |
comparison
equal
deleted
inserted
replaced
| 274:8d36073411b1 | 275:6253872024a4 |
|---|---|
| 3 | 3 |
| 4 use parent qw(IMPL::Class::MemberInfo); | 4 use parent qw(IMPL::Class::MemberInfo); |
| 5 | 5 |
| 6 our %CTOR = ( 'IMPL::Class::MemberInfo' => '@_' ); | 6 our %CTOR = ( 'IMPL::Class::MemberInfo' => '@_' ); |
| 7 | 7 |
| 8 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet ownerSet isList)); | 8 __PACKAGE__->mk_accessors(qw(type mutators canGet canSet ownerSet isList)); |
| 9 | 9 |
| 10 my %LoadedModules; | 10 my %LoadedModules; |
| 11 | 11 |
| 12 sub CTOR { | 12 sub CTOR { |
| 13 my $this = shift; | 13 my $this = shift; |
| 14 | 14 |
| 15 if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) { | 15 if ( my $type = $this->attributes ? delete $this->attributes->{type} : undef ) { |
| 16 $this->Type($type); | 16 $this->type($type); |
| 17 } | 17 } |
| 18 | 18 |
| 19 $this->Mutators(0) unless defined $this->Mutators; | 19 $this->mutators(0) unless defined $this->mutators; |
| 20 } | 20 } |
| 21 | 21 |
| 22 sub Implementor { | 22 sub implementor { |
| 23 my $this = shift; | 23 my $this = shift; |
| 24 | 24 |
| 25 if (@_) { | 25 if (@_) { |
| 26 $this->SUPER::Implementor(@_); | 26 $this->SUPER::implementor(@_); |
| 27 } else { | 27 } else { |
| 28 my $implementor = $this->SUPER::Implementor; | 28 my $implementor = $this->SUPER::implementor; |
| 29 return $implementor if $implementor; | 29 return $implementor if $implementor; |
| 30 | 30 |
| 31 $implementor = $this->SelectImplementor(); | 31 $implementor = $this->SelectImplementor(); |
| 32 | 32 |
| 33 $this->Implementor($implementor); | 33 $this->implementor($implementor); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } | 36 } |
| 37 | 37 |
| 38 sub SelectImplementor { | 38 sub SelectImplementor { |
| 39 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class); | 39 eval {$_[0]->class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class); |
| 40 } | |
| 41 | |
| 42 sub type { | |
| 43 goto &Type; | |
| 44 } | 40 } |
| 45 | 41 |
| 46 1; | 42 1; |
| 47 | 43 |
| 48 __END__ | 44 __END__ |
