Mercurial > pub > Impl
annotate Lib/IMPL/Class/PropertyInfo.pm @ 165:76515373dac0
Added Class::Template,
Rewritten SQL::Schema
'use parent' directive instead of 'use base'
author | wizard |
---|---|
date | Sat, 23 Apr 2011 23:06:48 +0400 |
parents | 6ce1f052b90a |
children | d1676be8afcc |
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; |