line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Class::Maker::Basic::Handler::Attributes;
|
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
625
|
use Class::Maker::Basic::Constructor; #qw(defaults);
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
432
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $name;
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub new
|
8
|
|
|
|
|
|
|
{
|
9
|
0
|
|
|
0
|
0
|
|
return \&Class::Maker::Basic::Constructor::new;
|
10
|
|
|
|
|
|
|
}
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub simple_new
|
13
|
|
|
|
|
|
|
{
|
14
|
0
|
|
|
0
|
0
|
|
return \&Class::Maker::Basic::Constructor::simple_new;
|
15
|
|
|
|
|
|
|
}
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub debug_verbose
|
18
|
|
|
|
|
|
|
{
|
19
|
0
|
|
|
0
|
0
|
|
my $name = $name;
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
return sub
|
22
|
|
|
|
|
|
|
{
|
23
|
0
|
0
|
|
0
|
|
|
warn "$name: it works..." if $DEBUG;
|
24
|
|
|
|
|
|
|
}
|
25
|
0
|
|
|
|
|
|
}
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# create an "lvalue" attribute handler, which also accepts
|
28
|
|
|
|
|
|
|
#
|
29
|
|
|
|
|
|
|
# $this->member = 'syntax' instead normal $this->member( 'syntax' );
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub default
|
32
|
|
|
|
|
|
|
{
|
33
|
0
|
|
|
0
|
0
|
|
my $name = $name;
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
return sub : lvalue
|
36
|
|
|
|
|
|
|
{
|
37
|
0
|
|
|
0
|
|
|
my $this = shift;
|
38
|
|
|
|
|
|
|
|
39
|
0
|
0
|
|
|
|
|
@_ ? $this->{$name} = shift : $this->{$name};
|
40
|
|
|
|
|
|
|
}
|
41
|
0
|
|
|
|
|
|
}
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub array
|
44
|
|
|
|
|
|
|
{
|
45
|
0
|
|
|
0
|
0
|
|
my $name = $name;
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
return sub
|
48
|
|
|
|
|
|
|
{
|
49
|
0
|
|
|
0
|
|
|
my $this = shift;
|
50
|
|
|
|
|
|
|
|
51
|
0
|
0
|
|
|
|
|
$this->{$name} = [] unless exists $this->{$name};
|
52
|
|
|
|
|
|
|
|
53
|
0
|
0
|
|
|
|
|
@{ $this->{$name} } = () if @_;
|
|
0
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
foreach ( @_ )
|
56
|
|
|
|
|
|
|
{
|
57
|
0
|
0
|
|
|
|
|
push @{ $this->{$name} }, ref($_) eq 'ARRAY' ? @{ $_ } : $_;
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
}
|
59
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
return wantarray ? @{$this->{$name}} : $this->{$name};
|
|
0
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
}
|
62
|
0
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub hash
|
65
|
|
|
|
|
|
|
{
|
66
|
0
|
|
|
0
|
0
|
|
my $name = $name;
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
return sub
|
69
|
|
|
|
|
|
|
{
|
70
|
0
|
|
|
0
|
|
|
my $this = shift;
|
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
|
|
|
unless( exists $this->{$name} )
|
73
|
|
|
|
|
|
|
{
|
74
|
0
|
|
|
|
|
|
$this->{$name} = {};
|
75
|
|
|
|
|
|
|
}
|
76
|
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
foreach my $href ( @_ )
|
78
|
|
|
|
|
|
|
{
|
79
|
0
|
0
|
|
|
|
|
if( ref($href) eq 'HASH' )
|
80
|
|
|
|
|
|
|
{
|
81
|
0
|
|
|
|
|
|
foreach my $key ( keys %{ $href } )
|
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
{
|
83
|
0
|
|
|
|
|
|
$this->{$name}->{$key} = $href->{$key};
|
84
|
|
|
|
|
|
|
}
|
85
|
|
|
|
|
|
|
}
|
86
|
|
|
|
|
|
|
}
|
87
|
|
|
|
|
|
|
|
88
|
0
|
0
|
|
|
|
|
return wantarray ? %{ $this->{$name} } : $this->{$name};
|
|
0
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
}
|
90
|
0
|
|
|
|
|
|
}
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1;
|