line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
755
|
use 5.006; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
3
|
1
|
|
|
1
|
|
2
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
165
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Object::Tiny::Lvalue; |
6
|
|
|
|
|
|
|
$Object::Tiny::Lvalue::VERSION = '1.083'; |
7
|
|
|
|
|
|
|
# ABSTRACT: minimal class builder with lvalue accessors |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
3
|
50
|
|
3
|
|
1525
|
return unless shift eq __PACKAGE__; |
11
|
3
|
|
|
|
|
4
|
my $pkg = caller; |
12
|
5
|
100
|
66
|
|
|
31
|
eval join "\n", ( |
13
|
|
|
|
|
|
|
"package $pkg;", |
14
|
|
|
|
|
|
|
'our @ISA = "Object::Tiny::Lvalue" unless @ISA;', |
15
|
|
|
|
|
|
|
map { |
16
|
3
|
|
|
1
|
0
|
5
|
defined and /\A[^\W\d]\w*\z/ or die "Invalid accessor name '$_'"; |
|
1
|
|
|
1
|
0
|
310
|
|
|
1
|
|
|
3
|
0
|
289
|
|
|
3
|
|
|
1
|
0
|
2193
|
|
|
1
|
|
|
|
|
1766
|
|
17
|
4
|
|
|
|
|
144
|
"sub $_ : lvalue { \$_[0]->{$_} }"; |
18
|
|
|
|
|
|
|
} @_ |
19
|
|
|
|
|
|
|
); |
20
|
2
|
50
|
|
|
|
3
|
die "Failed to generate $pkg" if $@; |
21
|
2
|
|
|
|
|
27
|
return 1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
2
|
|
|
2
|
0
|
1064
|
my $class = shift; |
26
|
2
|
|
|
|
|
7
|
bless { @_ }, $class; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |