| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
2
|
|
|
2
|
|
12906
|
use 5.006; |
|
|
2
|
|
|
|
|
10
|
|
|
|
2
|
|
|
|
|
94
|
|
|
2
|
2
|
|
|
2
|
|
12
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
71
|
|
|
3
|
2
|
|
|
2
|
|
9
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
66
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
10
|
use Sub::Quote (); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
122
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Method::Generate::Constructor::Role::Monjon; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
|
10
|
|
|
|
|
|
|
our $VERSION = '0.003'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
12
|
use Moo::Role; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
14
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub monjon_fields |
|
15
|
|
|
|
|
|
|
{ |
|
16
|
10
|
|
|
10
|
0
|
31
|
my $all = shift->all_attribute_specs; |
|
17
|
|
|
|
|
|
|
return |
|
18
|
6
|
50
|
33
|
|
|
110
|
sort { |
|
|
|
|
33
|
|
|
|
|
|
19
|
18
|
|
|
|
|
76
|
( |
|
20
|
|
|
|
|
|
|
defined($all->{$a}{_order}) |
|
21
|
|
|
|
|
|
|
and defined($all->{$b}{_order}) |
|
22
|
|
|
|
|
|
|
and $all->{$a}{_order} <=> $all->{$b}{_order} |
|
23
|
|
|
|
|
|
|
) |
|
24
|
|
|
|
|
|
|
or $all->{$a}{index} <=> $all->{$b}{index} |
|
25
|
|
|
|
|
|
|
} |
|
26
|
10
|
|
|
|
|
45
|
grep { exists($all->{$_}{pack}) } |
|
27
|
|
|
|
|
|
|
keys(%$all); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
before generate_method => sub |
|
31
|
|
|
|
|
|
|
{ |
|
32
|
|
|
|
|
|
|
my $self = shift; |
|
33
|
|
|
|
|
|
|
my ($into, $name, $spec, $quote_opts) = @_; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $maker = 'Monjon'->_accessor_maker_for($into); |
|
36
|
|
|
|
|
|
|
my $all = $self->all_attribute_specs; |
|
37
|
|
|
|
|
|
|
for my $field ($self->monjon_fields) |
|
38
|
|
|
|
|
|
|
{ |
|
39
|
|
|
|
|
|
|
my %spec = %{ $all->{$field} }; |
|
40
|
|
|
|
|
|
|
$spec{allow_overwrite} = 1; |
|
41
|
|
|
|
|
|
|
$maker->generate_method($into, $field, \%spec, $quote_opts); |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
around _handle_subconstructor => sub |
|
46
|
|
|
|
|
|
|
{ |
|
47
|
|
|
|
|
|
|
my $next = shift; |
|
48
|
|
|
|
|
|
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
my ($into, $name) = @_; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return sprintf( |
|
52
|
|
|
|
|
|
|
'$Monjon::INSTANCES_EXIST{"%s"} = 1; %s', |
|
53
|
|
|
|
|
|
|
quotemeta($into), |
|
54
|
|
|
|
|
|
|
$self->$next(@_), |
|
55
|
|
|
|
|
|
|
); |
|
56
|
|
|
|
|
|
|
}; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |