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