Mercurial > pub > Impl
annotate Lib/IMPL/Class/Property/Accessor.pm @ 77:9d24db321029
Refactoring Web::TT
docs
author | wizard |
---|---|
date | Fri, 02 Apr 2010 20:18:46 +0400 |
parents | b0c068da93ac |
children | 76515373dac0 |
rev | line source |
---|---|
60
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
1 package IMPL::Class::Property::Accessor; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
2 use strict; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
3 use base qw(IMPL::Class::Property::Base); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
4 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
5 sub factoryParams { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
6 $_[0]->SUPER::factoryParams, qw($field); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
7 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
8 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
9 sub RemapFactoryParams { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
10 my ($self,$propInfo) = @_; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
11 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
12 return $self->SUPER::RemapFactoryParams($propInfo),$propInfo->Name; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
13 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
14 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
15 sub GenerateGet { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
16 'return $this->get($field);'; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
17 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
18 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
19 sub GenerateSet { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
20 'return $this->set($field,@_);'; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
21 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
22 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
23 sub GenerateSetList { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
24 'my $val = IMPL::Object::List->new( (@_ == 1 and UNIVERSAL::isa($_[0], \'ARRAY\') ) ? $_[0] : [@_] ); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
25 $this->set($field,$val); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
26 return( wantarray ? @{ $val } : $val );'; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
27 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
28 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
29 sub GenerateGetList { |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
30 'my $val = $this->get($field); |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
31 $this->set($field,$val = IMPL::Object::List->new()) unless $val; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
32 return( wantarray ? @{ $val } : $val );'; |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
33 } |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
34 |
b0c068da93ac
Lazy activation for the configuration objects (final concept)
wizard
parents:
diff
changeset
|
35 1; |