Mercurial > pub > Impl
annotate Lib/IMPL/Class/PropertyInfo.pm @ 180:d1676be8afcc
Перекодировка в utf-8
author | sourcer |
---|---|
date | Fri, 30 Dec 2011 23:40:00 +0300 |
parents | 76515373dac0 |
children | a8db61d0ed33 |
rev | line source |
---|---|
49 | 1 package IMPL::Class::PropertyInfo; |
2 use strict; | |
163 | 3 use IMPL::_core::version; |
49 | 4 |
165 | 5 use parent qw(IMPL::Class::MemberInfo); |
49 | 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; | |
180 | 47 |
48 __END__ | |
49 | |
50 =pod | |
51 | |
52 =cut |