| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MooX::LazierAttributes; |
|
2
|
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
1618862
|
use strict; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
361
|
|
|
4
|
8
|
|
|
8
|
|
43
|
use warnings; |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
487
|
|
|
5
|
8
|
|
|
8
|
|
1193
|
use Moo; |
|
|
8
|
|
|
|
|
30970
|
|
|
|
8
|
|
|
|
|
84
|
|
|
6
|
8
|
|
|
8
|
|
11212
|
use Clone qw/clone/; |
|
|
8
|
|
|
|
|
4741
|
|
|
|
8
|
|
|
|
|
808
|
|
|
7
|
8
|
|
|
8
|
|
3977
|
use MooX::ReturnModifiers qw/return_has return_sub/; |
|
|
8
|
|
|
|
|
6763
|
|
|
|
8
|
|
|
|
|
563
|
|
|
8
|
8
|
|
|
8
|
|
22016
|
use namespace::clean (); |
|
|
8
|
|
|
|
|
165860
|
|
|
|
8
|
|
|
|
|
497
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.07010'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
8
|
|
|
8
|
|
70
|
use constant ro => 'ro'; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
571
|
|
|
13
|
8
|
|
|
8
|
|
67
|
use constant is_ro => ( is => ro ); |
|
|
8
|
|
|
|
|
24
|
|
|
|
8
|
|
|
|
|
530
|
|
|
14
|
8
|
|
|
8
|
|
49
|
use constant rw => 'rw'; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
507
|
|
|
15
|
8
|
|
|
8
|
|
44
|
use constant is_rw => ( is => rw ); |
|
|
8
|
|
|
|
|
18
|
|
|
|
8
|
|
|
|
|
499
|
|
|
16
|
8
|
|
|
8
|
|
45
|
use constant nan => undef; |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
623
|
|
|
17
|
8
|
|
|
8
|
|
47
|
use constant lzy => ( lazy => 1 ); |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
426
|
|
|
18
|
8
|
|
|
8
|
|
40
|
use constant bld => ( builder => 1 ); |
|
|
8
|
|
|
|
|
13
|
|
|
|
8
|
|
|
|
|
467
|
|
|
19
|
8
|
|
|
8
|
|
44
|
use constant lzy_bld => ( lazy_build => 1 ); |
|
|
8
|
|
|
|
|
12
|
|
|
|
8
|
|
|
|
|
431
|
|
|
20
|
8
|
|
|
8
|
|
77
|
use constant trg => ( trigger => 1 ); |
|
|
8
|
|
|
|
|
42
|
|
|
|
8
|
|
|
|
|
445
|
|
|
21
|
8
|
|
|
8
|
|
48
|
use constant clr => ( clearer => 1 ); |
|
|
8
|
|
|
|
|
16
|
|
|
|
8
|
|
|
|
|
457
|
|
|
22
|
8
|
|
|
8
|
|
41
|
use constant req => ( required => 1 ); |
|
|
8
|
|
|
|
|
22
|
|
|
|
8
|
|
|
|
|
2863
|
|
|
23
|
8
|
|
|
8
|
|
47
|
use constant coe => ( coerce => 1 ); |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
636
|
|
|
24
|
8
|
|
|
8
|
|
54
|
use constant lzy_hash => ( lazy => 1, default => sub { {} }); |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
3050
|
|
|
|
1
|
|
|
|
|
21014
|
|
|
25
|
8
|
|
|
8
|
|
46
|
use constant lzy_array => ( lazy => 1, default => sub { [] }); |
|
|
8
|
|
|
|
|
35
|
|
|
|
8
|
|
|
|
|
583
|
|
|
|
1
|
|
|
|
|
307383
|
|
|
26
|
8
|
|
|
8
|
|
45
|
use constant lzy_str => (lazy => 1, default => sub { "" }); |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
1642
|
|
|
|
1
|
|
|
|
|
1636
|
|
|
27
|
8
|
|
|
8
|
|
50
|
use constant dhash => (default => sub { {} }); |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
613
|
|
|
|
1
|
|
|
|
|
13
|
|
|
28
|
8
|
|
|
8
|
|
42
|
use constant darray => (default => sub { [] }); |
|
|
8
|
|
|
|
|
14
|
|
|
|
8
|
|
|
|
|
491
|
|
|
|
1
|
|
|
|
|
1868
|
|
|
29
|
8
|
|
|
8
|
|
46
|
use constant dstr => (default => sub { "" }); |
|
|
8
|
|
|
|
|
4078
|
|
|
|
8
|
|
|
|
|
4745
|
|
|
|
1
|
|
|
|
|
11
|
|
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub import { |
|
32
|
11
|
|
|
11
|
|
4438
|
my ($package, @export) = @_; |
|
33
|
11
|
|
|
|
|
31
|
my $target = caller; |
|
34
|
11
|
|
|
|
|
49
|
my $has = return_has($target); |
|
35
|
11
|
|
|
|
|
463
|
my $sub = return_sub($target); |
|
36
|
|
|
|
|
|
|
my $attributes = sub { |
|
37
|
5
|
|
|
5
|
|
829812
|
my @attr = @_; |
|
38
|
5
|
|
|
|
|
23
|
while (@attr) { |
|
39
|
31
|
100
|
|
|
|
93418
|
my @names = ref $attr[0] eq 'ARRAY' ? @{ shift @attr } : shift @attr; |
|
|
3
|
|
|
|
|
14
|
|
|
40
|
31
|
|
|
|
|
56
|
my @spec = @{ shift(@attr) }; |
|
|
31
|
|
|
|
|
91
|
|
|
41
|
|
|
|
|
|
|
|
|
42
|
31
|
|
|
|
|
82
|
my $eye = 1; |
|
43
|
|
|
|
|
|
|
splice @spec, $#spec < 1 ? 0 : $eye, 0, delete $spec[-1]->{default} |
|
44
|
31
|
100
|
100
|
|
|
85
|
if (grep { ref $spec[$_] eq 'Type::Tiny' and $eye = $#spec } (0 .. $#spec) or ref $spec[-1] eq 'HASH' && exists $spec[-1]->{default} ); |
|
|
56
|
100
|
100
|
|
|
340
|
|
|
|
|
100
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
31
|
|
|
|
|
91
|
for (@names) { |
|
47
|
36
|
100
|
100
|
|
|
3508
|
unshift @spec, 'set' if $_ =~ m/^\+/ and ( !$spec[0] || $spec[0] ne 'set' ); |
|
|
|
|
100
|
|
|
|
|
|
48
|
36
|
100
|
100
|
|
|
266
|
unshift @spec, ro unless ! ref $spec[0] and $spec[0] =~ m/^(ro|rw|set)$/; |
|
49
|
36
|
|
|
|
|
122
|
$has->( $_, _construct_attribute(@spec) ); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
} |
|
52
|
11
|
|
|
|
|
283
|
}; |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
my @ex = scalar @export |
|
55
|
11
|
100
|
|
|
|
64
|
? grep { !ref $_ } @export |
|
|
6
|
|
|
|
|
12
|
|
|
56
|
|
|
|
|
|
|
: qw/ro is_ro rw is_rw nan lzy bld lzy_bld trg clr req coe lzy_hash lzy_array/; # back compat as import used to accept a {} |
|
57
|
|
|
|
|
|
|
|
|
58
|
11
|
|
|
|
|
35
|
$sub->('attributes', $attributes); |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
{ |
|
61
|
8
|
|
|
8
|
|
81
|
no strict 'refs'; |
|
|
8
|
|
|
|
|
47
|
|
|
|
8
|
|
|
|
|
2774
|
|
|
|
11
|
|
|
|
|
159
|
|
|
62
|
132
|
|
|
|
|
339
|
${"${target}::"}{$_} = ${"${package}::"}{$_} |
|
|
132
|
|
|
|
|
331
|
|
|
63
|
11
|
|
|
|
|
36
|
foreach @ex; |
|
64
|
11
|
|
|
|
|
79
|
namespace::clean->import( |
|
65
|
|
|
|
|
|
|
-cleanee => $target, |
|
66
|
|
|
|
|
|
|
@ex, 'attributes' |
|
67
|
|
|
|
|
|
|
); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
|
|
70
|
11
|
|
|
|
|
2648
|
return 1; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub _construct_attribute { |
|
74
|
45
|
|
|
45
|
|
11655
|
my @spec = @_; |
|
75
|
45
|
|
|
|
|
108
|
my %attr = (); |
|
76
|
45
|
100
|
|
|
|
176
|
$attr{is} = $spec[0] unless $spec[0] eq 'set'; |
|
77
|
45
|
100
|
|
|
|
139
|
do { $attr{isa} = splice @spec, 1, 1; } if ref $spec[1] eq 'Type::Tiny'; |
|
|
7
|
|
|
|
|
22
|
|
|
78
|
26
|
|
|
26
|
|
56836
|
$attr{default} = ref $spec[1] eq 'CODE' ? $spec[1] : sub { clone( $spec[1] ) } |
|
79
|
45
|
100
|
|
|
|
290
|
if defined $spec[1]; |
|
|
|
100
|
|
|
|
|
|
|
80
|
45
|
|
|
|
|
82
|
$attr{$_} = $spec[2]->{$_} foreach keys %{ $spec[2] }; |
|
|
45
|
|
|
|
|
156
|
|
|
81
|
45
|
|
|
|
|
315
|
return %attr; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |