line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
=head1 NAME |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
Devel::PerlySense::Document::Api::Method - A method/sub |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 DESCRIPTION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
An Api::Method is a sub name and a location (possibly with a defined |
8
|
|
|
|
|
|
|
row, etc). |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
The Method has a documentation string and possibly POD. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=cut |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
8
|
|
|
8
|
|
1470
|
use strict; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
186
|
|
19
|
8
|
|
|
8
|
|
23
|
use warnings; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
171
|
|
20
|
8
|
|
|
8
|
|
25
|
use utf8; |
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
46
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package Devel::PerlySense::Document::Api::Method; |
23
|
|
|
|
|
|
|
$Devel::PerlySense::Document::Api::Method::VERSION = '0.0217'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
8
|
|
|
8
|
|
328
|
use Spiffy -Base; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
36
|
|
29
|
8
|
|
|
8
|
|
4941
|
use Carp; |
|
8
|
|
|
8
|
|
12
|
|
|
8
|
|
|
8
|
|
115
|
|
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
159
|
|
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
347
|
|
30
|
8
|
|
|
8
|
|
29
|
use Data::Dumper; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
293
|
|
31
|
8
|
|
|
8
|
|
24
|
use List::Util qw/ first /; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
324
|
|
32
|
|
|
|
|
|
|
|
33
|
8
|
|
|
8
|
|
28
|
use Devel::PerlySense::Document::Api; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
50
|
|
34
|
8
|
|
|
8
|
|
1424
|
use Devel::PerlySense::Document::Location; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
35
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 PROPERTIES |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 name |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
The method name |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Default: "". |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
field "name" => ""; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 oLocationDocumented |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
A Document::Location object specifying where the method is documented, |
58
|
|
|
|
|
|
|
or undef if that is unknown. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Default: undef. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=cut |
63
|
|
|
|
|
|
|
field "oLocationDocumented" => undef; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 oDocument |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
A PerlySense::Document object specifying in which the method belongs |
72
|
|
|
|
|
|
|
to. This does not have to be the Document where it's declared. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Default: undef. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=cut |
77
|
|
|
|
|
|
|
field "oDocument" => undef; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 signature |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Return doc string with the signature of the method, according to found |
86
|
|
|
|
|
|
|
documentation, usage, etc. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
Readonly. |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
75
|
|
|
75
|
1
|
117
|
sub signature { |
92
|
|
|
|
|
|
|
|
93
|
75
|
|
|
|
|
1167
|
my $signature = $self->name; |
94
|
75
|
|
|
|
|
1210
|
my $nameMethod = $self->name; |
95
|
75
|
100
|
|
|
|
1052
|
if(my $oLocation = $self->oLocationDocumented) { |
96
|
71
|
|
|
|
|
1154
|
my @aTextPod = split(/\n/, $oLocation->rhProperty->{text}); |
97
|
|
|
|
|
|
|
$signature = |
98
|
457
|
|
|
457
|
|
1850
|
first( sub { /->\s*\b$nameMethod\b/ }, @aTextPod ) |
99
|
71
|
|
33
|
134
|
|
903
|
|| first( sub { /\b$nameMethod\b/ }, @aTextPod ) |
|
134
|
|
|
|
|
1063
|
|
100
|
|
|
|
|
|
|
|| $signature; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
75
|
|
|
|
|
1304
|
$signature =~ s/ .* (\b$nameMethod\b) /$1/x; |
104
|
75
|
|
|
|
|
362
|
$signature =~ s/^ \s+ | \s* ; \s* $//gx; |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
75
|
|
|
|
|
226
|
return $signature; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 API METHODS |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 new(oDocument, name) |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Create new Method with $name belonging to $oDocument. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Set oLocationDocumented according to the found documentation. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
sub new(@) { |
124
|
76
|
|
|
76
|
1
|
2239
|
my $pkg = shift; |
125
|
76
|
|
|
|
|
199
|
my (%p) = @_; |
126
|
|
|
|
|
|
|
|
127
|
76
|
|
|
|
|
141
|
my $self = bless {}, $pkg; |
128
|
76
|
50
|
|
|
|
1098
|
$self->name($p{name}) or croak("Missing parameter name\n"); |
129
|
76
|
50
|
|
|
|
1484
|
$self->oDocument($p{oDocument}) or croak("Missing parameter oDocument\n"); |
130
|
76
|
|
|
|
|
1217
|
$self->oLocationDocumented( |
131
|
|
|
|
|
|
|
$self->oDocument->oPerlySense->oLocationMethodDocFromDocument( |
132
|
|
|
|
|
|
|
$self->oDocument, |
133
|
|
|
|
|
|
|
$self->name, |
134
|
|
|
|
|
|
|
) |
135
|
|
|
|
|
|
|
); |
136
|
|
|
|
|
|
|
|
137
|
76
|
|
|
|
|
769
|
return($self); |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head2 signatureCall($oLocationDeclaration) |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Return doc string with the call signature of the method, according to |
147
|
|
|
|
|
|
|
the $oLocationDeclaration, etc. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
The call signature is the signature with a call arrow, either -> or \> |
150
|
|
|
|
|
|
|
. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
71
|
|
|
71
|
1
|
112
|
sub signatureCall { |
154
|
71
|
|
|
|
|
107
|
my ($oLocationDeclaration) = @_; |
155
|
71
|
|
|
|
|
237
|
my $signature = $self->signature; |
156
|
|
|
|
|
|
|
|
157
|
71
|
100
|
|
|
|
1180
|
my $prefixCall = $self->oDocument->file eq $oLocationDeclaration->file ? '->' : '\>'; |
158
|
|
|
|
|
|
|
|
159
|
71
|
|
|
|
|
2860
|
return "$prefixCall$signature"; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
__END__ |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=encoding utf8 |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 AUTHOR |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Johan Lindstrom, C<< <johanl@cpan.org> >> |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 BUGS |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
183
|
|
|
|
|
|
|
C<bug-devel-perlysense@rt.cpan.org>, or through the web interface at |
184
|
|
|
|
|
|
|
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Devel-PerlySense>. |
185
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on |
186
|
|
|
|
|
|
|
your bug as I make changes. |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 COPYRIGHT & LICENSE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Copyright 2005 Johan Lindstrom, All Rights Reserved. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
195
|
|
|
|
|
|
|
under the same terms as Perl itself. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |