line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
326405
|
use 5.014; |
|
1
|
|
|
|
|
3
|
|
2
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
3
|
use Moose (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
6
|
1
|
|
|
1
|
|
317
|
use Kavorka (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
7
|
1
|
|
|
1
|
|
386
|
use Kavorka::Signature (); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
8
|
1
|
|
|
1
|
|
5
|
use Sub::Util (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
{ |
11
|
|
|
|
|
|
|
package MooseX::KavorkaInfo::DummyInfo; |
12
|
1
|
|
|
1
|
|
3
|
use Moose; with 'Kavorka::Sub'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
6
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
package MooseX::KavorkaInfo; |
17
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
18
|
|
|
|
|
|
|
our $VERSION = '0.037'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import |
21
|
|
|
|
|
|
|
{ |
22
|
3
|
|
|
3
|
|
8826
|
my $meta = Class::MOP::class_of(scalar caller); |
23
|
3
|
|
|
|
|
39
|
Moose::Util::MetaRole::apply_metaroles( |
24
|
|
|
|
|
|
|
for => $meta, |
25
|
|
|
|
|
|
|
role_metaroles => { |
26
|
|
|
|
|
|
|
method => ['MooseX::KavorkaInfo::Trait::Method'], |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
class_metaroles => { |
29
|
|
|
|
|
|
|
method => ['MooseX::KavorkaInfo::Trait::Method'], |
30
|
|
|
|
|
|
|
wrapped_method => ['MooseX::KavorkaInfo::Trait::WrappedMethod'], |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
package MooseX::KavorkaInfo::Trait::Method; |
38
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
39
|
|
|
|
|
|
|
our $VERSION = '0.037'; |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
5025
|
use Moose::Role; |
|
1
|
|
|
|
|
3076
|
|
|
1
|
|
|
|
|
3
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has _info => ( |
44
|
|
|
|
|
|
|
is => 'ro', |
45
|
|
|
|
|
|
|
lazy => 1, |
46
|
|
|
|
|
|
|
builder => '_build_info', |
47
|
|
|
|
|
|
|
handles => { |
48
|
|
|
|
|
|
|
declaration_keyword => 'keyword', |
49
|
|
|
|
|
|
|
signature => 'signature', |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _build_info |
54
|
|
|
|
|
|
|
{ |
55
|
1
|
|
|
1
|
|
3
|
my $self = shift; |
56
|
1
|
50
|
|
|
|
11
|
Kavorka->info( $self->body ) |
57
|
|
|
|
|
|
|
or MooseX::KavorkaInfo::DummyInfo->new( |
58
|
|
|
|
|
|
|
keyword => 'sub', |
59
|
|
|
|
|
|
|
qualified_name => Sub::Util::subname( $self->body ), |
60
|
|
|
|
|
|
|
body => $self->body, |
61
|
|
|
|
|
|
|
signature => 'Kavorka::Signature'->new(params => [], yadayada => 1), |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
{ |
67
|
|
|
|
|
|
|
package MooseX::KavorkaInfo::Trait::WrappedMethod; |
68
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
69
|
|
|
|
|
|
|
our $VERSION = '0.037'; |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
|
3574
|
use Moose::Role; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
72
|
|
|
|
|
|
|
with 'MooseX::KavorkaInfo::Trait::Method'; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
around _build_info => sub |
75
|
|
|
|
|
|
|
{ |
76
|
|
|
|
|
|
|
my $orig = shift; |
77
|
|
|
|
|
|
|
my $self = shift; |
78
|
|
|
|
|
|
|
Kavorka->info( $self->get_original_method->body ) |
79
|
|
|
|
|
|
|
or MooseX::KavorkaInfo::DummyInfo->new( |
80
|
|
|
|
|
|
|
keyword => 'sub', |
81
|
|
|
|
|
|
|
body => $self->body, |
82
|
|
|
|
|
|
|
signature => 'Kavorka::Signature'->new(params => [], yadayada => 1), |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
1; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
__END__ |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=pod |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=encoding utf-8 |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 NAME |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
MooseX::KavorkaInfo - make Kavorka->info available through Moose meta objects |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SYNOPSIS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
package Foo { |
102
|
|
|
|
|
|
|
use Moose; |
103
|
|
|
|
|
|
|
use MooseX::KavorkaInfo; |
104
|
|
|
|
|
|
|
use Kavorka qw( -default -modifiers ); |
105
|
|
|
|
|
|
|
method xxx (Int $x) { return $x ** 3 } |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
package Foo::Verbose { |
109
|
|
|
|
|
|
|
use Moose; |
110
|
|
|
|
|
|
|
use MooseX::KavorkaInfo; |
111
|
|
|
|
|
|
|
use Kavorka qw( -default -modifiers ); |
112
|
|
|
|
|
|
|
extends "Foo"; |
113
|
|
|
|
|
|
|
before xxx { warn "Called xxx" } |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $method = Foo::Verbose->meta->get_method("xxx"); |
117
|
|
|
|
|
|
|
say $method->signature->params->[1]->type->name; # says "Int" |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 DESCRIPTION |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
MooseX::KavorkaInfo adds two extra methods to the Moose::Meta::Method |
122
|
|
|
|
|
|
|
meta objects associated with a class. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
It "sees through" method modifiers to inspect the original method |
125
|
|
|
|
|
|
|
declaration. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 Methods |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=over |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item C<signature> |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Returns a L<Kavorka::Signature> object. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item C<declaration_keyword> |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Returns a string indicating what keyword the method was declared with. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=back |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 BUGS |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Please report any bugs to |
144
|
|
|
|
|
|
|
L<http://rt.cpan.org/Dist/Display.html?Queue=Kavorka>. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 SEE ALSO |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L<Kavorka::Manual::API>, |
149
|
|
|
|
|
|
|
L<Moose::Meta::Method>. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head1 AUTHOR |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Toby Inkster E<lt>tobyink@cpan.orgE<gt>. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This software is copyright (c) 2013-2014, 2017 by Toby Inkster. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
160
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 DISCLAIMER OF WARRANTIES |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED |
165
|
|
|
|
|
|
|
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF |
166
|
|
|
|
|
|
|
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
167
|
|
|
|
|
|
|
|