annotate Lib/IMPL/Class/PropertyInfo.pm @ 21:fafe56cfcd69

temp commit
author Sergey
date Wed, 30 Sep 2009 10:25:41 +0400
parents e59f44f75f20
children b544a772b654
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 my %LoadedModules;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
10
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
12 my $this = shift;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
13
4
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
14 $this->Mutators(0) unless defined $this->Mutators;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
15 }
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
16
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
17 sub Implementor {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
18 my $this = shift;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
19
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
20 my $implementor;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
21
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
22 if (@_) {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
23 $this->SUPER::Implementor(@_);
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
24 } else {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
25 my $implementor = $this->SUPER::Implementor;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
26 return $implementor if $implementor;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
27
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
28 $implementor = $this->SelectImplementor();
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
29
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
30 if (my $class = ref $implementor ? undef : $implementor) {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
31 if (not $LoadedModules{$class}) {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
32 (my $package = $class.'.pm') =~ s/::/\//g;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
33 require $package;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
34 $LoadedModules{$class} = 1;
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
35 }
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
36 }
4
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
37
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
38 $this->Implementor($implementor);
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
39 return $implementor;
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
40 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
41
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
42 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
43
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
44 sub SelectImplementor {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
45 my ($this) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
46
4
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
47 if ($this->Class->can('_PropertyImplementor')) {
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
48 return $this->Class->_PropertyImplementor;
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
49 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
50 die new IMPL::Exception('Can\'t find a property implementor for the specified class',$this->Class);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
51 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
52
4
e59f44f75f20 DOM - в разработке
Sergey
parents: 0
diff changeset
53 1;