| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package perl5i::2::Signature; |
|
2
|
|
|
|
|
|
|
|
|
3
|
103
|
|
|
103
|
|
3433
|
use 5.010_000; |
|
|
103
|
|
|
|
|
359
|
|
|
|
103
|
|
|
|
|
5357
|
|
|
4
|
103
|
|
|
103
|
|
780
|
use strict; |
|
|
103
|
|
|
|
|
272
|
|
|
|
103
|
|
|
|
|
4028
|
|
|
5
|
103
|
|
|
103
|
|
521
|
use warnings; |
|
|
103
|
|
|
|
|
192
|
|
|
|
103
|
|
|
|
|
3387
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
103
|
|
|
103
|
|
92243
|
use perl5i::2::Signature::Method::None; |
|
|
103
|
|
|
|
|
460
|
|
|
|
103
|
|
|
|
|
3476
|
|
|
8
|
103
|
|
|
103
|
|
94333
|
use perl5i::2::Signature::Function::None; |
|
|
103
|
|
|
|
|
289
|
|
|
|
103
|
|
|
|
|
15377
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# A proxy class to hold a method's signature until its actually used. |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use overload |
|
13
|
10
|
|
|
10
|
|
2541
|
q[""] => sub { return $_[0]->as_string }, |
|
14
|
103
|
|
|
|
|
949
|
fallback => 1 |
|
15
|
103
|
|
|
103
|
|
612
|
; |
|
|
103
|
|
|
|
|
210
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
2012
|
|
|
2012
|
0
|
9005
|
my $class = shift; |
|
20
|
2012
|
|
|
|
|
5673
|
my %args = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
2012
|
|
50
|
|
|
5270
|
my $string = $args{signature} // ''; |
|
23
|
2012
|
|
100
|
|
|
4360
|
my $is_method = $args{is_method} // 0; |
|
24
|
|
|
|
|
|
|
|
|
25
|
2012
|
|
100
|
|
|
10597
|
my $no_params = !$string || $string !~ /\S/; |
|
26
|
2012
|
100
|
|
|
|
4155
|
if( $no_params ) { |
|
27
|
227
|
100
|
|
|
|
9396
|
return $is_method ? perl5i::2::Signature::Method::None->new( signature => $string ) |
|
28
|
|
|
|
|
|
|
: perl5i::2::Signature::Function::None->new( signature => $string ); |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
else { |
|
31
|
1785
|
|
|
|
|
14874
|
return bless { signature => $string, is_method => $is_method }, $class; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub as_string { |
|
36
|
10
|
|
|
10
|
0
|
19
|
my $self = shift; |
|
37
|
10
|
|
|
|
|
57
|
return $self->{signature}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub make_real { |
|
41
|
11
|
|
|
11
|
0
|
25
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
|
|
43
|
11
|
|
|
|
|
3661
|
require perl5i::2::Signature::Real; |
|
44
|
11
|
|
|
|
|
61
|
bless $self, "perl5i::2::Signature::Real"; |
|
45
|
|
|
|
|
|
|
|
|
46
|
11
|
|
|
|
|
66
|
$self->__parse_signature; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Upgrade to a real signature object |
|
50
|
|
|
|
|
|
|
# and call the original method. |
|
51
|
|
|
|
|
|
|
# This should only be called once per object. |
|
52
|
|
|
|
|
|
|
our $AUTOLOAD; |
|
53
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
54
|
11
|
|
|
11
|
|
8861
|
my($method) = reverse split /::/, $AUTOLOAD; |
|
55
|
11
|
50
|
|
|
|
60
|
return if $method eq 'DESTROY'; |
|
56
|
|
|
|
|
|
|
|
|
57
|
11
|
|
|
|
|
30
|
my $self = $_[0]; # leave @_ alone |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
# Upgrade to a real object |
|
60
|
11
|
|
|
|
|
47
|
$self->make_real; |
|
61
|
|
|
|
|
|
|
|
|
62
|
11
|
|
|
|
|
142
|
goto $self->can($method); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |