line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: SimpleExporter.pm,v 1.5 2007/07/13 00:00:14 ask Exp $ |
2
|
|
|
|
|
|
|
# $Source: /opt/CVS/Getopt-LL/lib/Getopt/LL/SimpleExporter.pm,v $ |
3
|
|
|
|
|
|
|
# $Author: ask $ |
4
|
|
|
|
|
|
|
# $HeadURL$ |
5
|
|
|
|
|
|
|
# $Revision: 1.5 $ |
6
|
|
|
|
|
|
|
# $Date: 2007/07/13 00:00:14 $ |
7
|
|
|
|
|
|
|
package Getopt::LL::SimpleExporter; |
8
|
20
|
|
|
20
|
|
45503
|
use strict; |
|
20
|
|
|
|
|
54
|
|
|
20
|
|
|
|
|
736
|
|
9
|
20
|
|
|
20
|
|
106
|
use warnings; |
|
20
|
|
|
|
|
32
|
|
|
20
|
|
|
|
|
550
|
|
10
|
20
|
|
|
20
|
|
979
|
use version; our $VERSION = qv('1.0.0'); |
|
20
|
|
|
|
|
2376
|
|
|
20
|
|
|
|
|
111
|
|
11
|
20
|
|
|
20
|
|
1679
|
use 5.006_001; |
|
20
|
|
|
|
|
352
|
|
|
20
|
|
|
|
|
2360
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %EXPORTS_FOR_PACKAGE = (); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub import { |
16
|
24
|
|
|
24
|
|
77
|
my @exports = @_; |
17
|
24
|
|
|
|
|
55
|
my $caller = caller; |
18
|
|
|
|
|
|
|
|
19
|
24
|
|
|
|
|
51
|
$EXPORTS_FOR_PACKAGE{$caller} = {map { $_ => 1} @exports}; |
|
105
|
|
|
|
|
293
|
|
20
|
|
|
|
|
|
|
|
21
|
20
|
|
|
20
|
|
117
|
no strict 'refs'; ## no critic; |
|
20
|
|
|
|
|
34
|
|
|
20
|
|
|
|
|
2268
|
|
22
|
24
|
|
|
|
|
68
|
*{ $caller . q{::} . 'import' } = \&simple_export; |
|
24
|
|
|
|
|
160
|
|
23
|
24
|
|
|
|
|
55
|
@{ $caller . q{::} . 'EXPORT_OK' } = @exports; |
|
24
|
|
|
|
|
143
|
|
24
|
|
|
|
|
|
|
|
25
|
24
|
|
|
|
|
1573
|
return; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub simple_export { |
29
|
24
|
|
|
24
|
1
|
2811
|
my ($class, @tags) = @_; |
30
|
24
|
|
|
|
|
65
|
my $caller = caller; |
31
|
|
|
|
|
|
|
|
32
|
20
|
|
|
20
|
|
103
|
no strict 'refs'; ## no critic |
|
20
|
|
|
|
|
38
|
|
|
20
|
|
|
|
|
3815
|
|
33
|
24
|
|
|
|
|
126
|
while (@tags) { |
34
|
26
|
|
|
|
|
55
|
my $export_attr = shift @tags; |
35
|
26
|
|
|
|
|
44
|
my %exports = %{ $EXPORTS_FOR_PACKAGE{$class} }; |
|
26
|
|
|
|
|
145
|
|
36
|
|
|
|
|
|
|
|
37
|
26
|
100
|
|
|
|
121
|
if (!exists $exports{$export_attr}) { |
38
|
2
|
|
|
|
|
14
|
require Carp; |
39
|
2
|
|
|
|
|
78
|
Carp->import('croak'); |
40
|
2
|
|
|
|
|
331
|
croak("$class does not export $export_attr"); ## no critic |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
24
|
|
|
|
|
40
|
my $sub = *{ "$class\::$export_attr" }{CODE}; ## no critic |
|
24
|
|
|
|
|
102
|
|
44
|
24
|
|
|
|
|
41
|
*{ $caller . q{::} . $export_attr } = $sub; |
|
24
|
|
|
|
|
184
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
22
|
|
|
|
|
2031751
|
return; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |