line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package EntityModel::Class::Accessor::Hash; |
2
|
|
|
|
|
|
|
$EntityModel::Class::Accessor::Hash::VERSION = '0.016'; |
3
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
1
|
|
|
1
|
|
7
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use parent qw{EntityModel::Class::Accessor}; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
67
|
use EntityModel::Hash; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
378
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
EntityModel::Class::Accessor::Array - generic class accessor for arrays |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Version 0.016 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
See L. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=cut |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 method_list |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Returns a hash of method definitions. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub method_list { |
33
|
2
|
|
|
2
|
1
|
9
|
my ($class, %opt) = @_; |
34
|
2
|
|
|
|
|
4
|
my $k = $opt{k}; |
35
|
2
|
50
|
|
|
|
6
|
if(my $pre = $opt{pre}) { |
36
|
|
|
|
|
|
|
return sub { |
37
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
0
|
$pre->($self, @_) or return; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
0
|
if(@_) { |
42
|
0
|
0
|
|
|
|
0
|
$self->{$k} = ref $_[0] eq 'HASH' ? EntityModel::Hash->new($_[0]) : $_[0]; |
43
|
|
|
|
|
|
|
} |
44
|
0
|
0
|
|
|
|
0
|
unless($self->{$k}) { |
45
|
0
|
|
|
|
|
0
|
$self->{$k} = EntityModel::Hash->new($self->{$k}); |
46
|
|
|
|
|
|
|
} |
47
|
0
|
|
|
|
|
0
|
return $self->{$k}; |
48
|
0
|
|
|
|
|
0
|
}; |
49
|
|
|
|
|
|
|
} else { |
50
|
|
|
|
|
|
|
return sub { |
51
|
10
|
|
|
10
|
|
18
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
10
|
50
|
|
|
|
26
|
if(@_) { |
54
|
0
|
0
|
0
|
|
|
0
|
return $self->{$k}->get(@_) if @_ == 1 && !ref($_[0]); |
55
|
0
|
0
|
|
|
|
0
|
$self->{$k} = ref $_[0] eq 'HASH' ? EntityModel::Hash->new($_[0]) : $_[0]; |
56
|
|
|
|
|
|
|
} |
57
|
10
|
100
|
|
|
|
65
|
unless($self->{$k}) { |
58
|
2
|
|
|
|
|
16
|
$self->{$k} = EntityModel::Hash->new($self->{$k}); |
59
|
|
|
|
|
|
|
} |
60
|
10
|
|
|
|
|
53
|
return $self->{$k}; |
61
|
2
|
|
|
|
|
23
|
}; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |