line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EntityModel::Web::Page::Data; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$EntityModel::Web::Page::Data::VERSION = '0.004'; |
4
|
|
|
|
|
|
|
} |
5
|
|
|
|
|
|
|
use EntityModel::Class { |
6
|
1
|
|
|
|
|
16
|
key => { type => 'string' }, |
7
|
|
|
|
|
|
|
value => { type => 'string' }, |
8
|
|
|
|
|
|
|
class => { type => 'string' }, |
9
|
|
|
|
|
|
|
instance => { type => 'string' }, |
10
|
|
|
|
|
|
|
method => { type => 'string' }, |
11
|
|
|
|
|
|
|
data => { type => 'string' }, |
12
|
|
|
|
|
|
|
parameter => { type => 'array', subclass => 'EntityModel::Web::Page::Data' }, |
13
|
1
|
|
|
1
|
|
775
|
}; |
|
1
|
|
|
|
|
2
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=pod |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Accepts the following items: |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=over 4 |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=item * key - the name to assign to this data value |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=item * value - static value to assign |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=item * class - a class to call a method on |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=item * instance - an instance on which to call the given method |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=item * method - a method to call |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item * data - an existing data item |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item * param - parameters to pass to the method |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=back |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
41
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
42
|
0
|
0
|
|
|
|
|
my %args = ref $_[0] ? %{$_[0]} : @_; |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
foreach my $item (qw(key value class method instance data)) { |
45
|
0
|
0
|
|
|
|
|
if(defined(my $v = delete $args{$item})) { |
46
|
0
|
|
|
|
|
|
$self->$item($v); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# Recurse for any defined parameters |
51
|
0
|
0
|
|
|
|
|
if(defined(my $param = delete $args{parameter})) { |
52
|
0
|
|
|
|
|
|
foreach my $p (@$param) { |
53
|
0
|
|
|
|
|
|
$self->parameter->push( |
54
|
|
|
|
|
|
|
EntityModel::Web::Page::Data->new(%$p) |
55
|
|
|
|
|
|
|
); |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|