Mercurial > pub > Impl
comparison Lib/IMPL/Class/PropertyInfo.pm @ 0:03e58a454b20
Создан репозитарий
author | Sergey |
---|---|
date | Tue, 14 Jul 2009 12:54:37 +0400 |
parents | |
children | e59f44f75f20 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:03e58a454b20 |
---|---|
1 package IMPL::Class::PropertyInfo; | |
2 use strict; | |
3 | |
4 use base qw(IMPL::Class::MemberInfo); | |
5 | |
6 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet)); | |
7 __PACKAGE__->PassThroughArgs; | |
8 | |
9 our @Implementors = ( ['IMPL::Object' => 'IMPL::Class::Property::Direct'] ); | |
10 | |
11 my %LoadedModules; | |
12 | |
13 sub CTOR { | |
14 my $this = shift; | |
15 | |
16 my $implementor = $this->Implementor($this->SelectImplementor()); | |
17 if (my $class = ref $implementor ? undef : $implementor) { | |
18 if (not $LoadedModules{$class}) { | |
19 (my $package = $class.'.pm') =~ s/::/\//g; | |
20 require $package; | |
21 $LoadedModules{$class} = 1; | |
22 } | |
23 } | |
24 | |
25 $this->Mutators(0) unless defined $this->Mutators; | |
26 } | |
27 | |
28 sub SelectImplementor { | |
29 my ($this) = @_; | |
30 | |
31 foreach my $item (@Implementors) { | |
32 return $item->[1] if $this->Class->isa($item->[0]); | |
33 } | |
34 | |
35 die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class); | |
36 } | |
37 | |
38 1; |