line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::ComposedBehavior::Guts; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
$MooseX::ComposedBehavior::Guts::VERSION = '0.004'; |
4
|
|
|
|
|
|
|
} |
5
|
5
|
|
|
5
|
|
4360
|
use MooseX::Role::Parameterized 0.21; |
|
5
|
|
|
|
|
408390
|
|
|
5
|
|
|
|
|
37
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: the gooey, meaty bits that help MooseX::ComposedBehavior work |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
200417
|
use Moose::Util::TypeConstraints; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
53
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
parameter stub_method_name => ( |
12
|
|
|
|
|
|
|
isa => 'Str', |
13
|
|
|
|
|
|
|
required => 1, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
parameter method_name => ( |
17
|
|
|
|
|
|
|
isa => 'Str', |
18
|
|
|
|
|
|
|
required => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
subtype 'MooseX::ComposedBehavior::Stub::_MethodList', |
22
|
|
|
|
|
|
|
as 'ArrayRef[Str|CodeRef]'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
coerce 'MooseX::ComposedBehavior::Stub::_MethodList', |
25
|
|
|
|
|
|
|
from 'CodeRef', via { [$_] }, |
26
|
|
|
|
|
|
|
from 'Str', via { [$_] }; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
parameter also_compose => ( |
29
|
|
|
|
|
|
|
isa => 'MooseX::ComposedBehavior::Stub::_MethodList', |
30
|
|
|
|
|
|
|
coerce => 1, |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
parameter compositor => ( |
34
|
|
|
|
|
|
|
isa => 'CodeRef', |
35
|
|
|
|
|
|
|
required => 1, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
parameter context => ( |
39
|
|
|
|
|
|
|
isa => enum([ qw(list scalar) ]), |
40
|
|
|
|
|
|
|
predicate => 'forces_context', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
parameter method_order => ( |
44
|
|
|
|
|
|
|
isa => enum([ qw(standard reverse) ]), |
45
|
|
|
|
|
|
|
default => 'standard', |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
role { |
49
|
|
|
|
|
|
|
my ($p) = @_; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
my $wantarray = $p->forces_context ? ($p->context eq 'list' ? 1 : 0) : undef; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $stub_name = $p->stub_method_name; |
54
|
4
|
|
|
4
|
|
19
|
method $stub_name => sub { }; |
|
6
|
|
|
6
|
|
24
|
|
|
4
|
|
|
6
|
|
20
|
|
|
4
|
|
|
6
|
|
7959
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
2
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $method_name = $p->method_name; |
57
|
|
|
|
|
|
|
my $compositor = $p->compositor; |
58
|
|
|
|
|
|
|
my $also_compose = $p->also_compose; |
59
|
|
|
|
|
|
|
my $reverse = $p->method_order eq 'reverse'; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
method $method_name => sub { |
62
|
2
|
|
|
2
|
|
571
|
my $self = shift; |
|
6
|
|
|
6
|
|
27087
|
|
|
4
|
|
|
6
|
|
17580
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
4
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
36
|
my $results = []; |
|
6
|
|
|
|
|
12
|
|
|
4
|
|
|
|
|
12
|
|
65
|
|
|
|
|
|
|
|
66
|
2
|
50
|
|
|
|
8
|
my $wantarray = defined $wantarray ? $wantarray : wantarray; |
|
6
|
100
|
|
|
|
15
|
|
|
4
|
100
|
|
|
|
19
|
|
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
8
|
my @methods = Class::MOP::class_of($self) |
|
6
|
|
|
|
|
24
|
|
|
4
|
|
|
|
|
18
|
|
69
|
|
|
|
|
|
|
->find_all_methods_by_name($stub_name); |
70
|
|
|
|
|
|
|
|
71
|
2
|
50
|
|
|
|
453
|
@methods = reverse @methods if $reverse; |
|
6
|
50
|
|
|
|
902
|
|
|
4
|
50
|
|
|
|
783
|
|
72
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
4
|
foreach my $method (@methods) { |
|
6
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
11
|
|
74
|
4
|
|
|
|
|
5
|
my @array; |
|
6
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
4
|
|
75
|
4
|
100
|
|
|
|
29
|
$wantarray ? (@array = $method->{code}->execute($self, \@_, $results)) |
|
6
|
100
|
|
|
|
34
|
|
|
4
|
50
|
|
|
|
30
|
|
76
|
|
|
|
|
|
|
: (scalar $method->{code}->execute($self, \@_, $results)); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
2
|
50
|
|
|
|
12
|
if (defined $also_compose) { |
|
6
|
50
|
|
|
|
18
|
|
|
4
|
50
|
|
|
|
20
|
|
80
|
2
|
|
|
|
|
4
|
for my $also_method (@$also_compose) { |
|
6
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
10
|
|
81
|
2
|
100
|
|
|
|
16
|
push @$results, ($wantarray |
|
6
|
100
|
|
|
|
25
|
|
|
5
|
50
|
|
|
|
134
|
|
82
|
|
|
|
|
|
|
? [ $self->$also_method(@_) ] : scalar $self->$also_method(@_)); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
2
|
|
|
|
|
22
|
return $compositor->($self, \@$results); |
|
6
|
|
|
|
|
42
|
|
|
4
|
|
|
|
|
51
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
}; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
__END__ |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=pod |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 NAME |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
MooseX::ComposedBehavior::Guts - the gooey, meaty bits that help MooseX::ComposedBehavior work |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 VERSION |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
version 0.004 |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 OVERVIEW |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
MooseX::ComposedBehavior::Guts contains a bunch of code that is used by |
107
|
|
|
|
|
|
|
L<MooseX::ComposedBehavior> to get its job done. It is basically a hack, and |
108
|
|
|
|
|
|
|
relying on any part of its interface would be a I<terrible> idea. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Reading the source, on the other hand, might be useful in understanding what |
111
|
|
|
|
|
|
|
the heck is going on, especially if you encounter weird problem. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Ricardo Signes <rjbs@cpan.org> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
This software is copyright (c) 2013 by Ricardo Signes. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
122
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |