comparison Lib/IMPL/Class/PropertyInfo.pm @ 134:44977efed303

Significant performance optimizations Fixed recursion problems due converting objects to JSON Added cache support for the templates Added discovery feature for the web methods
author wizard
date Mon, 21 Jun 2010 02:39:53 +0400
parents b0c068da93ac
children 6ce1f052b90a
comparison
equal deleted inserted replaced
133:a07a66fd8d5c 134:44977efed303
18 $this->Mutators(0) unless defined $this->Mutators; 18 $this->Mutators(0) unless defined $this->Mutators;
19 } 19 }
20 20
21 sub Implementor { 21 sub Implementor {
22 my $this = shift; 22 my $this = shift;
23 23
24 my $implementor;
25
26 if (@_) { 24 if (@_) {
27 $this->SUPER::Implementor(@_); 25 $this->SUPER::Implementor(@_);
28 } else { 26 } else {
29 my $implementor = $this->SUPER::Implementor; 27 my $implementor = $this->SUPER::Implementor;
30 return $implementor if $implementor; 28 return $implementor if $implementor;
31 29
32 $implementor = $this->SelectImplementor(); 30 $implementor = $this->SelectImplementor();
33 31
34 if (my $class = ref $implementor ? undef : $implementor) { 32 if (my $class = ref $implementor ? undef : $implementor) {
35 if (not $LoadedModules{$class}) { 33 eval "require $class; 1;" or die $@ unless $LoadedModules{$class}++;
36 (my $package = $class.'.pm') =~ s/::/\//g;
37 require $package;
38 $LoadedModules{$class} = 1;
39 }
40 } 34 }
41 35
42 $this->Implementor($implementor); 36 $this->Implementor($implementor);
43 return $implementor;
44 } 37 }
45 38
46 } 39 }
47 40
48 sub SelectImplementor { 41 sub SelectImplementor {
49 my ($this) = @_; 42 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class);
50
51 if ($this->Class->can('_PropertyImplementor')) {
52 return $this->Class->_PropertyImplementor;
53 }
54 die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class);
55 } 43 }
56 44
57 1; 45 1;