line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
47452
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
128
|
|
2
|
|
|
|
|
|
|
package Class::Accessor::Chained; |
3
|
2
|
|
|
2
|
|
14
|
use base 'Class::Accessor'; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
2627
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub make_accessor { |
7
|
3
|
|
|
3
|
1
|
155
|
my($class, $field) = @_; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Build a closure around $field. |
10
|
|
|
|
|
|
|
return sub { |
11
|
5
|
|
|
5
|
|
1762
|
my($self) = shift; |
12
|
|
|
|
|
|
|
|
13
|
5
|
100
|
|
|
|
13
|
if (@_) { |
14
|
4
|
|
|
|
|
22
|
$self->set($field, @_); |
15
|
4
|
|
|
|
|
42
|
return $self; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
else { |
18
|
1
|
|
|
|
|
12
|
return $self->get($field); |
19
|
|
|
|
|
|
|
} |
20
|
3
|
|
|
|
|
18
|
}; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub make_wo_accessor { |
24
|
0
|
|
|
0
|
1
|
|
my($class, $field) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return sub { |
27
|
0
|
|
|
0
|
|
|
my($self) = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
|
unless (@_) { |
30
|
0
|
|
|
|
|
|
my $caller = caller; |
31
|
0
|
|
|
|
|
|
require Carp; |
32
|
0
|
|
|
|
|
|
Carp::croak("'$caller' cannot access the value of '$field' on ". |
33
|
|
|
|
|
|
|
"objects of class '$class'"); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
else { |
36
|
0
|
|
|
|
|
|
$self->set($field, @_); |
37
|
0
|
|
|
|
|
|
return $self; |
38
|
|
|
|
|
|
|
} |
39
|
0
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |
43
|
|
|
|
|
|
|
__END__ |