annotate Lib/IMPL/Web/TT/Collection.pm @ 235:a4d9126edcbb

code cleaning
author sergey
date Fri, 12 Oct 2012 02:08:51 +0400
parents 4d0e1962161c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
107
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
1 package IMPL::Web::TT::Collection;
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
2 use strict;
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
3
166
4267a2ac3d46 Added Class::Template,
wizard
parents: 154
diff changeset
4 use parent qw(IMPL::DOM::Node);
107
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
5
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
6 __PACKAGE__->PassThroughArgs;
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
7
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
8 our $AUTOLOAD;
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
9 sub AUTOLOAD {
194
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
10 my $this = shift;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
11 my ($method) = ($AUTOLOAD =~ /(\w+)$/);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
12
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
13 return if $method eq 'DESTROY';
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
14
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
15 if ( @_ >= 1 ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
16 # set
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
17
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
18 if ($method =~ /^add(\w+)/) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
19 my ($name,$args) = @_;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
20 return $this->appendChild($this->document->CreateControl($name,$1,$args));
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
21 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
22
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
23 # we can't assing a node, so this is a dynamic property
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
24 return $this->nodeProperty($method,@_);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
25 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
26 # get
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
27 # try a dynamic property first
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
28 if ( my $val = $this->nodeProperty($method) ) {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
29 return $val;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
30 } else {
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
31 # and return a first child node as last opportunity
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
32 my @result = $this->selectNodes($method);
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
33
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
34 return $result[0] if @result;
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
35 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
36 }
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
37
4d0e1962161c Replaced tabs with spaces
cin
parents: 180
diff changeset
38 return;
107
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
39 }
0e72ad99eef7 Updated Web::TT
wizard
parents:
diff changeset
40
180
d1676be8afcc Перекодировка в utf-8
sourcer
parents: 166
diff changeset
41 1;