annotate Lib/IMPL/Class/PropertyInfo.pm @ 159:f8de52d3c112

IMPL::Test::Unit minor changes
author wizard
date Mon, 27 Dec 2010 01:37:44 +0300
parents 44977efed303
children 6ce1f052b90a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
1 package IMPL::Class::PropertyInfo;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
3
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
4 use base qw(IMPL::Class::MemberInfo);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
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
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
7 __PACKAGE__->PassThroughArgs;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
8
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
9 my %LoadedModules;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
10
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
11 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
12 my $this = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
13
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
14 if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
15 $this->Type($type);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
16 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
17
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
18 $this->Mutators(0) unless defined $this->Mutators;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
19 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
20
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
21 sub Implementor {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
22 my $this = shift;
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
23
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
24 if (@_) {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
25 $this->SUPER::Implementor(@_);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
26 } else {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
27 my $implementor = $this->SUPER::Implementor;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
28 return $implementor if $implementor;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
29
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
30 $implementor = $this->SelectImplementor();
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
31
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
32 if (my $class = ref $implementor ? undef : $implementor) {
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
33 eval "require $class; 1;" or die $@ unless $LoadedModules{$class}++;
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
34 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
35
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
36 $this->Implementor($implementor);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
37 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
38
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
39 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
40
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
41 sub SelectImplementor {
134
44977efed303 Significant performance optimizations
wizard
parents: 60
diff changeset
42 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class);
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
43 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
44
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 27
diff changeset
45 1;