Mercurial > pub > Impl
annotate Lib/IMPL/Class/PropertyInfo.pm @ 163:6ce1f052b90a
temp commit
author | wizard |
---|---|
date | Tue, 15 Mar 2011 02:32:42 +0300 |
parents | 44977efed303 |
children | 76515373dac0 |
rev | line source |
---|---|
49 | 1 package IMPL::Class::PropertyInfo; |
2 use strict; | |
163 | 3 use IMPL::_core::version; |
49 | 4 |
5 use base qw(IMPL::Class::MemberInfo); | |
6 | |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
7 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet ownerSet)); |
49 | 8 __PACKAGE__->PassThroughArgs; |
9 | |
10 my %LoadedModules; | |
11 | |
12 sub CTOR { | |
13 my $this = shift; | |
14 | |
15 if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) { | |
16 $this->Type($type); | |
17 } | |
18 | |
19 $this->Mutators(0) unless defined $this->Mutators; | |
20 } | |
21 | |
22 sub Implementor { | |
23 my $this = shift; | |
134 | 24 |
49 | 25 if (@_) { |
26 $this->SUPER::Implementor(@_); | |
27 } else { | |
28 my $implementor = $this->SUPER::Implementor; | |
29 return $implementor if $implementor; | |
30 | |
31 $implementor = $this->SelectImplementor(); | |
32 | |
33 if (my $class = ref $implementor ? undef : $implementor) { | |
134 | 34 eval "require $class; 1;" or die $@ unless $LoadedModules{$class}++; |
49 | 35 } |
36 | |
37 $this->Implementor($implementor); | |
38 } | |
39 | |
40 } | |
41 | |
42 sub SelectImplementor { | |
134 | 43 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class); |
49 | 44 } |
45 | |
46 1; |