annotate Lib/IMPL/Class/PropertyInfo.pm @ 0:03e58a454b20

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