Mercurial > pub > Impl
annotate Lib/IMPL/Web/TT/Collection.pm @ 159:f8de52d3c112
IMPL::Test::Unit minor changes
author | wizard |
---|---|
date | Mon, 27 Dec 2010 01:37:44 +0300 |
parents | eb478083f72b |
children | 4267a2ac3d46 |
rev | line source |
---|---|
107 | 1 package IMPL::Web::TT::Collection; |
2 use strict; | |
3 | |
4 use base qw(IMPL::DOM::Node); | |
5 | |
6 __PACKAGE__->PassThroughArgs; | |
7 | |
8 our $AUTOLOAD; | |
9 sub AUTOLOAD { | |
10 my $this = shift; | |
11 my ($method) = ($AUTOLOAD =~ /(\w+)$/); | |
12 | |
109
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
13 return if $method eq 'DESTROY'; |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
14 |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
15 if ( @_ >= 1 ) { |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
16 # set |
150 | 17 |
18 if ($method =~ /^add(\w+)/) { | |
19 my ($name,$args) = @_; | |
20 return $this->appendChild($this->document->CreateControl($name,$1,$args)); | |
21 } | |
22 | |
109
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
23 # we can't assing a node, so this is a dynamic property |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
24 return $this->nodeProperty($method,@_); |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
25 } else { |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
26 # get |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
27 # try a dynamic property first |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
28 if ( my $val = $this->nodeProperty($method) ) { |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
29 return $val; |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
30 } else { |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
31 # and return a first child node as last opportunity |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
32 my @result = $this->selectNodes($method); |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
33 |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
34 return $result[0] if @result; |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
35 } |
ddf0f037d460
IMPL::DOM::Node updated to support TT, (added childNodesRef and selectNodesRef for using from TT)
wizard
parents:
107
diff
changeset
|
36 } |
150 | 37 |
38 return; | |
107 | 39 } |
40 | |
41 1; |