line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::NativeTraits::MethodProvider; |
2
|
19
|
|
|
19
|
|
15781
|
use Mouse; |
|
19
|
|
|
|
|
42
|
|
|
19
|
|
|
|
|
128
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
has attr => ( |
5
|
|
|
|
|
|
|
is => 'ro', |
6
|
|
|
|
|
|
|
isa => 'Object', |
7
|
|
|
|
|
|
|
required => 1, |
8
|
|
|
|
|
|
|
weak_ref => 1, |
9
|
|
|
|
|
|
|
); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has reader => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
lazy_build => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has writer => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
lazy_build => 1, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub _build_reader { |
24
|
62
|
|
|
62
|
|
121
|
my($self) = @_; |
25
|
62
|
|
|
|
|
483
|
return $self->attr->get_read_method_ref; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _build_writer { |
29
|
53
|
|
|
53
|
|
95
|
my($self) = @_; |
30
|
53
|
|
|
|
|
330
|
return $self->attr->get_write_method_ref; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub has_generator { |
34
|
527
|
|
|
527
|
1
|
995
|
my($self, $name) = @_; |
35
|
527
|
|
|
|
|
1284
|
return $self->meta->has_method("generate_$name"); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub generate { |
39
|
526
|
|
|
526
|
1
|
905
|
my($self, $handle_name, $method_to_call) = @_; |
40
|
|
|
|
|
|
|
|
41
|
526
|
|
|
|
|
569
|
my @curried_args; |
42
|
526
|
|
|
|
|
536
|
($method_to_call, @curried_args) = @{$method_to_call}; |
|
526
|
|
|
|
|
1377
|
|
43
|
|
|
|
|
|
|
|
44
|
526
|
|
|
|
|
1463
|
my $code = $self->meta |
45
|
|
|
|
|
|
|
->get_method_body("generate_$method_to_call")->($self); |
46
|
|
|
|
|
|
|
|
47
|
526
|
100
|
|
|
|
1359
|
if(@curried_args){ |
48
|
|
|
|
|
|
|
return sub { |
49
|
453
|
|
|
453
|
|
352162
|
my $instance = shift; |
|
|
|
|
453
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
430
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
400
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
380
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
|
260
|
|
|
|
50
|
453
|
|
|
|
|
1716
|
$code->($instance, @curried_args, @_); |
51
|
171
|
|
|
|
|
2587
|
}; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
else{ |
54
|
355
|
|
|
|
|
3778
|
return $code; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub get_generators { |
59
|
0
|
|
|
0
|
1
|
0
|
my($self) = @_; |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return grep{ s/\A generate_ //xms } $self->meta->get_method_list; |
|
0
|
|
|
|
|
0
|
|
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub argument_error { |
65
|
620
|
|
|
620
|
0
|
1533
|
my($self, $name, $min, $max, $nargs) = @_; |
66
|
|
|
|
|
|
|
|
67
|
620
|
100
|
|
|
|
1676
|
if(not defined $max) { |
68
|
10
|
|
|
|
|
23
|
$max = 9 ** 9 ** 9; # inifinity :p |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# fix numbers for $self |
72
|
620
|
|
|
|
|
2132
|
$min--; |
73
|
620
|
|
|
|
|
714
|
$max--; |
74
|
620
|
|
|
|
|
764
|
$nargs--; |
75
|
|
|
|
|
|
|
|
76
|
620
|
50
|
66
|
|
|
3027
|
if($min <= $nargs and $nargs <= $max) { |
77
|
0
|
|
|
|
|
0
|
Carp::croak("Oops ($name): nags=$nargs, min=$min, max=$max"); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
620
|
|
|
|
|
873
|
my $message = 'Cannot call %s %s argument%s'; |
81
|
|
|
|
|
|
|
|
82
|
620
|
100
|
66
|
|
|
2412
|
if($min == 0 and $max == 0 && $nargs > 0) { |
|
|
|
66
|
|
|
|
|
83
|
180
|
|
|
|
|
1162
|
$self->meta->throw_error( |
84
|
|
|
|
|
|
|
sprintf $message, |
85
|
|
|
|
|
|
|
$name, 'with any', 's' ); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
$self->meta->throw_error( |
89
|
440
|
100
|
|
|
|
1647
|
sprintf 'Cannot call %s %s %d argument%s', |
|
|
50
|
|
|
|
|
|
90
|
|
|
|
|
|
|
$name, ($nargs < $min |
91
|
|
|
|
|
|
|
? ('without at least', $min) |
92
|
|
|
|
|
|
|
: ('with more than', $max) ), |
93
|
|
|
|
|
|
|
$nargs == 1 ? '' : 's' ); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
19
|
|
|
19
|
|
25984
|
no Mouse; |
|
19
|
|
|
|
|
250
|
|
|
19
|
|
|
|
|
117
|
|
97
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(strict_constructor => 1); |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |