Mercurial > pub > Impl
annotate Lib/IMPL/Class/PropertyInfo.pm @ 229:47f77e6409f7
heavily reworked the resource model of the web application:
*some ResourcesContraact functionality moved to Resource
+Added CustomResource
*Corrected action handlers
author | sergey |
---|---|
date | Sat, 29 Sep 2012 02:34:47 +0400 |
parents | 431db7034a88 |
children | 6d8092d8ce1b |
rev | line source |
---|---|
49 | 1 package IMPL::Class::PropertyInfo; |
2 use strict; | |
163 | 3 use IMPL::_core::version; |
49 | 4 |
228 | 5 use parent qw(IMPL::Class::MemberInfo); |
6 | |
7 our %CTOR = ( 'IMPL::Class::MemberInfo' => '@_' ); | |
49 | 8 |
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
49
diff
changeset
|
9 __PACKAGE__->mk_accessors(qw(Type Mutators canGet canSet ownerSet)); |
49 | 10 |
11 my %LoadedModules; | |
12 | |
13 sub CTOR { | |
14 my $this = shift; | |
15 | |
16 if ( my $type = $this->Attributes ? delete $this->Attributes->{type} : undef ) { | |
17 $this->Type($type); | |
18 } | |
19 | |
20 $this->Mutators(0) unless defined $this->Mutators; | |
21 } | |
22 | |
23 sub Implementor { | |
24 my $this = shift; | |
134 | 25 |
49 | 26 if (@_) { |
27 $this->SUPER::Implementor(@_); | |
28 } else { | |
29 my $implementor = $this->SUPER::Implementor; | |
30 return $implementor if $implementor; | |
31 | |
32 $implementor = $this->SelectImplementor(); | |
33 | |
34 if (my $class = ref $implementor ? undef : $implementor) { | |
134 | 35 eval "require $class; 1;" or die $@ unless $LoadedModules{$class}++; |
49 | 36 } |
37 | |
38 $this->Implementor($implementor); | |
39 } | |
40 | |
41 } | |
42 | |
43 sub SelectImplementor { | |
134 | 44 eval {$_[0]->Class->_PropertyImplementor} or die new IMPL::Exception('Can\'t find a property implementor for the specified class',$_[0]->Class); |
49 | 45 } |
46 | |
47 1; | |
180 | 48 |
49 __END__ | |
50 | |
51 =pod | |
52 | |
209 | 53 =head1 NAME |
54 | |
55 C<IMPL::Class::PropertyInfo> - метаданные о свойствах объектов. Используются для отражения и | |
56 проверки данных объектов. | |
57 | |
58 =head1 DESCRIPTION | |
59 | |
60 В зависимости от типа каждый объект предоставляет способ хранения данных, например хеши позволяют | |
61 хранить состояние в виде ассоциативного массива и т.д. Информация о свойстве предоставляет определенный | |
62 уровень абстракции. | |
63 | |
180 | 64 =cut |