Mercurial > pub > Impl
diff Lib/IMPL/Class/PropertyInfo.pm @ 49:16ada169ca75
migrating to the Eclipse IDE
author | wizard@linux-odin.local |
---|---|
date | Fri, 26 Feb 2010 10:49:21 +0300 |
parents | b544a772b654 |
children | b0c068da93ac |
line wrap: on
line diff
--- a/Lib/IMPL/Class/PropertyInfo.pm Fri Feb 26 01:43:42 2010 +0300 +++ b/Lib/IMPL/Class/PropertyInfo.pm Fri Feb 26 10:49:21 2010 +0300 @@ -1,57 +1,57 @@ -package IMPL::Class::PropertyInfo; -use strict; - -use base qw(IMPL::Class::MemberInfo); - -__PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet)); -__PACKAGE__->PassThroughArgs; - -my %LoadedModules; - -sub CTOR { - my $this = shift; - - if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) { - $this->Type($type); - } - - $this->Mutators(0) unless defined $this->Mutators; -} - -sub Implementor { - my $this = shift; - - my $implementor; - - if (@_) { - $this->SUPER::Implementor(@_); - } else { - my $implementor = $this->SUPER::Implementor; - return $implementor if $implementor; - - $implementor = $this->SelectImplementor(); - - if (my $class = ref $implementor ? undef : $implementor) { - if (not $LoadedModules{$class}) { - (my $package = $class.'.pm') =~ s/::/\//g; - require $package; - $LoadedModules{$class} = 1; - } - } - - $this->Implementor($implementor); - return $implementor; - } - -} - -sub SelectImplementor { - my ($this) = @_; - - if ($this->Class->can('_PropertyImplementor')) { - return $this->Class->_PropertyImplementor; - } - die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class); -} - -1; \ No newline at end of file +package IMPL::Class::PropertyInfo; +use strict; + +use base qw(IMPL::Class::MemberInfo); + +__PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet)); +__PACKAGE__->PassThroughArgs; + +my %LoadedModules; + +sub CTOR { + my $this = shift; + + if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) { + $this->Type($type); + } + + $this->Mutators(0) unless defined $this->Mutators; +} + +sub Implementor { + my $this = shift; + + my $implementor; + + if (@_) { + $this->SUPER::Implementor(@_); + } else { + my $implementor = $this->SUPER::Implementor; + return $implementor if $implementor; + + $implementor = $this->SelectImplementor(); + + if (my $class = ref $implementor ? undef : $implementor) { + if (not $LoadedModules{$class}) { + (my $package = $class.'.pm') =~ s/::/\//g; + require $package; + $LoadedModules{$class} = 1; + } + } + + $this->Implementor($implementor); + return $implementor; + } + +} + +sub SelectImplementor { + my ($this) = @_; + + if ($this->Class->can('_PropertyImplementor')) { + return $this->Class->_PropertyImplementor; + } + die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class); +} + +1;