line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Exporter::Easiest; |
2
|
|
|
|
|
|
|
$Exporter::Easiest::VERSION = '0.17'; |
3
|
1
|
|
|
1
|
|
23971
|
use 5.006; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
66
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
25
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
no strict 'refs'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
446
|
|
8
|
|
|
|
|
|
|
require Exporter::Easy; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub import |
11
|
|
|
|
|
|
|
{ |
12
|
2
|
|
|
2
|
|
234
|
my $pkg = shift; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
4
|
my $callpkg = caller(0); |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
7
|
@_ = ($callpkg, parse_spec(@_)); |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
10
|
goto &Exporter::Easy::set_export_vars; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub parse_spec |
22
|
|
|
|
|
|
|
{ |
23
|
|
|
|
|
|
|
# maybe we were passed a string or an array of strings, allow both |
24
|
|
|
|
|
|
|
|
25
|
13
|
|
|
13
|
0
|
33
|
my @spec = grep { /\S/ } map { split(/\s+/) } @_; |
|
110
|
|
|
|
|
272
|
|
|
15
|
|
|
|
|
67
|
|
26
|
|
|
|
|
|
|
|
27
|
13
|
|
|
|
|
22
|
my %spec; |
28
|
|
|
|
|
|
|
|
29
|
13
|
|
|
|
|
29
|
my $key = ""; |
30
|
|
|
|
|
|
|
|
31
|
13
|
|
|
|
|
31
|
while (@spec) |
32
|
|
|
|
|
|
|
{ |
33
|
28
|
|
|
|
|
46
|
my $new_key = shift @spec; |
34
|
28
|
|
|
|
|
54
|
my $arrow = shift @spec; |
35
|
28
|
100
|
|
|
|
62
|
$arrow = "" unless defined($arrow); |
36
|
28
|
100
|
|
|
|
69
|
die "Expected '=>' not '$arrow' after $new_key" unless ($arrow eq '=>'); |
37
|
|
|
|
|
|
|
|
38
|
27
|
100
|
|
|
|
81
|
if ($new_key =~ s/^://) |
39
|
|
|
|
|
|
|
{ |
40
|
|
|
|
|
|
|
# if the new key starts with a : then it and the following list are |
41
|
|
|
|
|
|
|
# pushed onto the TAGS entry |
42
|
|
|
|
|
|
|
|
43
|
8
|
|
|
|
|
10
|
push(@{$spec{TAGS}}, $new_key, suck_list(\@spec)); |
|
8
|
|
|
|
|
23
|
|
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else |
46
|
|
|
|
|
|
|
{ |
47
|
19
|
|
|
|
|
25
|
$key = $new_key; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# VARS and ISA should aren't necessarily a list |
50
|
|
|
|
|
|
|
|
51
|
19
|
100
|
100
|
|
|
123
|
if( |
|
|
|
100
|
|
|
|
|
52
|
|
|
|
|
|
|
($key =~ /^(VARS|ISA)$/ and $spec[0] =~ /^\d+$/) or |
53
|
|
|
|
|
|
|
($key eq 'ALL') |
54
|
|
|
|
|
|
|
) |
55
|
|
|
|
|
|
|
{ |
56
|
4
|
|
|
|
|
28
|
$spec{$key} = shift @spec; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
else |
59
|
|
|
|
|
|
|
{ |
60
|
15
|
|
|
|
|
36
|
$spec{$key} = suck_list(\@spec); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
12
|
|
|
|
|
115
|
return %spec; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub suck_list |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
# takes a ref to a list and removes elements from the front of the list |
71
|
|
|
|
|
|
|
# until the list is empty or it's 2 shift away from removing a => |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# returns a ref to a list of the removed list elements |
74
|
|
|
|
|
|
|
|
75
|
25
|
|
|
25
|
0
|
1182
|
my $list = shift; |
76
|
|
|
|
|
|
|
|
77
|
25
|
|
|
|
|
33
|
my @sucked; |
78
|
|
|
|
|
|
|
|
79
|
25
|
|
|
|
|
54
|
while (@$list) |
80
|
|
|
|
|
|
|
{ |
81
|
67
|
100
|
100
|
|
|
248
|
if ($#$list and ($list->[1] eq '=>')) |
82
|
|
|
|
|
|
|
{ |
83
|
15
|
|
|
|
|
21
|
last; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
else |
86
|
|
|
|
|
|
|
{ |
87
|
52
|
|
|
|
|
152
|
push(@sucked, shift(@$list)); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
25
|
|
|
|
|
122
|
return \@sucked; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Exporter::Easiest - Takes even more drudgery out of Exporting symbols |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 SYNOPSIS |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
In module YourModule.pm: |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
package YourModule; |
103
|
|
|
|
|
|
|
use Exporter::Easiest q( |
104
|
|
|
|
|
|
|
EXPORT => :tag1 |
105
|
|
|
|
|
|
|
OK => munge frobnicate |
106
|
|
|
|
|
|
|
:tag1 => a b c |
107
|
|
|
|
|
|
|
:tag2 => :tag1 d e f |
108
|
|
|
|
|
|
|
FAIL => f g h |
109
|
|
|
|
|
|
|
); |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
In other files which wish to use YourModule: |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
use ModuleName qw(frobnicate); # import listed symbols |
114
|
|
|
|
|
|
|
frobnicate ($left, $right) # calls YourModule::frobnicate |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 DESCRIPTION |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The Exporter::Easiest module is a wrapper around Exporter::Easy. It allows |
119
|
|
|
|
|
|
|
you to pass the arguments into Exporter::Easy without all those tiresome []s |
120
|
|
|
|
|
|
|
and qw()s. You pass arguments in as a string or an array of strings. You no |
121
|
|
|
|
|
|
|
longer need to bracket lists or take references. If want, you can also leave |
122
|
|
|
|
|
|
|
out the TAGS key and just put tag definitions along with the other keys. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The important thing to remember is that tags should be preceded by ':' |
125
|
|
|
|
|
|
|
everywhere, including to the left of the '=>', otherwise it'll get confused. |
126
|
|
|
|
|
|
|
And don't worry I haven't done something horribly pythonesque, whitespace is |
127
|
|
|
|
|
|
|
not significant, all the parsing logic revolves around the use of ':'s and |
128
|
|
|
|
|
|
|
'=>'s |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SEE ALSO |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
For the real details on exporting symbols see L |
133
|
|
|
|
|
|
|
and L. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 REPOSITORY |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
L |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 AUTHOR |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Written by Fergal Daly . |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 LICENSE |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Under the same license as Perl itself |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=cut |