line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Exporter::Declare::Magic; |
2
|
1
|
|
|
1
|
|
110261
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.107'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Devel::Declare::Parser; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
25
|
|
8
|
1
|
|
|
1
|
|
927
|
use aliased 'Exporter::Declare::Magic::Sub'; |
|
1
|
|
|
|
|
864
|
|
|
1
|
|
|
|
|
6
|
|
9
|
1
|
|
|
1
|
|
80
|
use aliased 'Exporter::Declare::Export::Generator'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
2949
|
use Carp qw/croak/; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
84
|
|
11
|
|
|
|
|
|
|
our @CARP_NOT = qw/ |
12
|
|
|
|
|
|
|
Exporter::Declare |
13
|
|
|
|
|
|
|
Exporter::Declare::Specs |
14
|
|
|
|
|
|
|
Exporter::Declare::Meta |
15
|
|
|
|
|
|
|
Exporter::Declare::Magic |
16
|
|
|
|
|
|
|
/; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
BEGIN { |
19
|
1
|
50
|
|
1
|
|
23
|
die "Devel::Declare::Parser version >= 0.017 is required for -magic\n" |
20
|
|
|
|
|
|
|
unless $Devel::Declare::Parser::VERSION gt '0.016'; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
923
|
use Devel::Declare::Parser::Sublike; |
|
1
|
|
|
|
|
368
|
|
|
1
|
|
|
|
|
31
|
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
5
|
use base 'Exporter::Declare'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
982
|
|
26
|
|
|
|
|
|
|
use Exporter::Declare |
27
|
1
|
|
|
|
|
11
|
'default_exports', |
28
|
|
|
|
|
|
|
'reexport', |
29
|
|
|
|
|
|
|
export => {-as => 'ed_export'}, |
30
|
|
|
|
|
|
|
gen_export => {-as => 'ed_gen_export'}, |
31
|
|
|
|
|
|
|
default_export => {-as => 'ed_default_export'}, |
32
|
1
|
|
|
1
|
|
21706
|
gen_default_export => {-as => 'ed_gen_default_export'}; |
|
1
|
|
|
|
|
3
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
default_exports qw/ |
35
|
|
|
|
|
|
|
parsed_exports |
36
|
|
|
|
|
|
|
parsed_default_exports |
37
|
|
|
|
|
|
|
/; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
parsed_default_exports( sublike => qw/parser/ ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
parsed_default_exports( |
42
|
|
|
|
|
|
|
export => qw/ |
43
|
|
|
|
|
|
|
export |
44
|
|
|
|
|
|
|
gen_export |
45
|
|
|
|
|
|
|
default_export |
46
|
|
|
|
|
|
|
gen_default_export |
47
|
|
|
|
|
|
|
/ |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Exporter::Declare::Meta->add_hash_metric('parsers'); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
reexport('Exporter::Declare'); |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub export { |
55
|
8
|
|
|
8
|
1
|
11781
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
56
|
8
|
|
|
|
|
311
|
_export( $class, undef, @_ ); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub gen_export { |
60
|
1
|
|
|
1
|
1
|
105
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
61
|
1
|
|
|
|
|
23
|
_export( $class, Generator(), @_ ); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub default_export { |
65
|
0
|
|
|
0
|
1
|
0
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
66
|
0
|
|
|
|
|
0
|
my $meta = $class->export_meta; |
67
|
0
|
|
|
|
|
0
|
$meta->export_tags_push( 'default', _export( $class, undef, @_ ) ); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub gen_default_export { |
71
|
1
|
|
|
1
|
1
|
119
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
72
|
1
|
|
|
|
|
25
|
my $meta = $class->export_meta; |
73
|
1
|
|
|
|
|
5
|
$meta->export_tags_push( 'default', _export( $class, Generator(), @_ ) ); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _export { |
77
|
15
|
|
|
15
|
|
40
|
my %params = Exporter::Declare::_parse_export_params(@_); |
78
|
15
|
|
|
|
|
543
|
my ($parser) = @{$params{args}}; |
|
15
|
|
|
|
|
29
|
|
79
|
15
|
100
|
|
|
|
35
|
if ($parser) { |
80
|
7
|
|
|
|
|
12
|
my $ec = $params{export_class}; |
81
|
7
|
50
|
66
|
|
|
32
|
if ( $ec && $ec eq Generator ) { |
82
|
0
|
|
|
|
|
0
|
$params{extra_exporter_props} = {parser => $parser, type => Sub}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
else { |
85
|
7
|
|
|
|
|
11
|
$params{export_class} = Sub; |
86
|
7
|
|
|
|
|
24
|
$params{extra_exporter_props} = {parser => $parser}; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
15
|
|
|
|
|
52
|
Exporter::Declare::_add_export(%params); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub parser { |
93
|
0
|
|
|
0
|
1
|
0
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
94
|
0
|
|
|
|
|
0
|
my $name = shift; |
95
|
0
|
|
|
|
|
0
|
my $code = pop; |
96
|
0
|
0
|
0
|
|
|
0
|
croak "You must provide a name to parser()" |
97
|
|
|
|
|
|
|
if !$name || ref $name; |
98
|
0
|
0
|
0
|
|
|
0
|
croak "Too many parameters passed to parser()" |
99
|
|
|
|
|
|
|
if @_ && defined $_[0]; |
100
|
0
|
|
0
|
|
|
0
|
$code ||= $class->can($name); |
101
|
0
|
0
|
|
|
|
0
|
croak "Could not find code for parser '$name'" |
102
|
|
|
|
|
|
|
unless $code; |
103
|
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
0
|
$class->export_meta->parsers_add( $name, $code ); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub parsed_exports { |
108
|
0
|
|
|
0
|
1
|
0
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
109
|
0
|
|
|
|
|
0
|
my ( $parser, @items ) = @_; |
110
|
0
|
0
|
|
|
|
0
|
croak "no parser specified" unless $parser; |
111
|
0
|
|
|
|
|
0
|
_export( $class, Sub(), $_, $parser ) for @items; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub parsed_default_exports { |
115
|
2
|
|
|
2
|
1
|
7
|
my $class = Exporter::Declare::_find_export_class( \@_ ); |
116
|
2
|
|
|
|
|
57
|
my ( $parser, @names ) = @_; |
117
|
2
|
50
|
|
|
|
7
|
croak "no parser specified" unless $parser; |
118
|
|
|
|
|
|
|
|
119
|
2
|
|
|
|
|
4
|
for my $name (@names) { |
120
|
5
|
|
|
|
|
264
|
_export( $class, Sub(), $name, $parser ); |
121
|
5
|
|
|
|
|
484
|
$class->export_meta->export_tags_push( 'default', $name ); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
1; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
__END__ |