line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Object::Tiny; # git description: 5abde2e |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
2441
|
use strict 'vars', 'subs'; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
763
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub import { |
8
|
3
|
50
|
|
3
|
|
579
|
return unless shift eq 'Object::Tiny'; |
9
|
3
|
|
|
|
|
9
|
my $pkg = caller; |
10
|
3
|
|
|
|
|
4
|
my $child = !! @{"${pkg}::ISA"}; |
|
3
|
|
|
|
|
16
|
|
11
|
|
|
|
|
|
|
eval join "\n", |
12
|
|
|
|
|
|
|
"package $pkg;", |
13
|
|
|
|
|
|
|
($child ? () : "\@${pkg}::ISA = 'Object::Tiny';"), |
14
|
|
|
|
|
|
|
map { |
15
|
3
|
50
|
33
|
2
|
|
14
|
defined and ! ref and /^[^\W\d]\w*\z/s |
|
5
|
100
|
66
|
2
|
|
60
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
4567
|
|
16
|
|
|
|
|
|
|
or die "Invalid accessor name '$_'"; |
17
|
4
|
|
|
|
|
194
|
"sub $_ { return \$_[0]->{$_} }" |
18
|
|
|
|
|
|
|
} @_; |
19
|
2
|
50
|
|
|
|
11
|
die "Failed to generate $pkg" if $@; |
20
|
2
|
|
|
|
|
35
|
return 1; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
2
|
|
|
2
|
0
|
1700
|
my $class = shift; |
25
|
2
|
|
|
|
|
7
|
bless { @_ }, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |