| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test::Stream::Exporter::Meta; |
|
2
|
109
|
|
|
109
|
|
1216
|
use strict; |
|
|
109
|
|
|
|
|
1269
|
|
|
|
109
|
|
|
|
|
2843
|
|
|
3
|
109
|
|
|
109
|
|
500
|
use warnings; |
|
|
109
|
|
|
|
|
187
|
|
|
|
109
|
|
|
|
|
3488
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
my %EXPORT_META; |
|
6
|
|
|
|
|
|
|
|
|
7
|
109
|
|
|
109
|
|
554
|
use Carp qw/croak confess/; |
|
|
109
|
|
|
|
|
175
|
|
|
|
109
|
|
|
|
|
40364
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub EXPORTS() { 'exports' } |
|
10
|
|
|
|
|
|
|
sub PACKAGE() { 'package' } |
|
11
|
|
|
|
|
|
|
sub DEFAULT() { 'default' } |
|
12
|
|
|
|
|
|
|
|
|
13
|
8640
|
|
|
8640
|
1
|
21622
|
sub exports { $_[0]->{+EXPORTS} } |
|
14
|
4310
|
|
|
4310
|
1
|
16834
|
sub default { $_[0]->{+DEFAULT} } |
|
15
|
1
|
|
|
1
|
0
|
4
|
sub package { $_[0]->{+PACKAGE} } |
|
16
|
|
|
|
|
|
|
|
|
17
|
12038
|
|
|
12038
|
1
|
350716
|
sub get { $EXPORT_META{$_[-1]} } |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
|
20
|
10322
|
|
|
10322
|
1
|
16796
|
my ($class, $pkg) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
10322
|
100
|
|
|
|
21859
|
confess "Package is required!" |
|
23
|
|
|
|
|
|
|
unless $pkg; |
|
24
|
|
|
|
|
|
|
|
|
25
|
10321
|
|
|
|
|
15703
|
my $meta = $EXPORT_META{$pkg}; |
|
26
|
10321
|
100
|
|
|
|
37066
|
return $meta if $meta; |
|
27
|
|
|
|
|
|
|
|
|
28
|
1685
|
|
|
|
|
8372
|
$meta = bless({ |
|
29
|
|
|
|
|
|
|
EXPORTS() => {}, |
|
30
|
|
|
|
|
|
|
DEFAULT() => [], |
|
31
|
|
|
|
|
|
|
PACKAGE() => $pkg, |
|
32
|
|
|
|
|
|
|
}, $class); |
|
33
|
|
|
|
|
|
|
|
|
34
|
1685
|
|
|
|
|
19208
|
return $EXPORT_META{$pkg} = $meta; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub add { |
|
38
|
1151
|
|
|
1151
|
1
|
2514
|
my ($self, $default, $name, $ref) = @_; |
|
39
|
|
|
|
|
|
|
|
|
40
|
1151
|
100
|
|
|
|
2829
|
confess "Name is mandatory" unless $name; |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
confess "$name is already exported" |
|
43
|
1150
|
100
|
|
|
|
3301
|
if $self->{+EXPORTS}->{$name}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
1149
|
|
|
|
|
2054
|
my $pkg = $self->{+PACKAGE}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
1149
|
100
|
|
|
|
2660
|
unless ($ref) { |
|
48
|
109
|
|
|
109
|
|
632
|
no strict 'refs'; |
|
|
109
|
|
|
|
|
197
|
|
|
|
109
|
|
|
|
|
20900
|
|
|
49
|
3
|
|
|
|
|
7
|
$ref = *{"$pkg\::$name"}{CODE}; |
|
|
3
|
|
|
|
|
22
|
|
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
1149
|
100
|
66
|
|
|
5900
|
confess "No reference or package sub found for '$name' in '$pkg'" |
|
53
|
|
|
|
|
|
|
unless $ref && ref $ref; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Add the export ref |
|
56
|
1148
|
|
|
|
|
2911
|
$self->{+EXPORTS}->{$name} = $ref; |
|
57
|
1148
|
100
|
|
|
|
3994
|
push @{$self->{+DEFAULT}} => $name if $default; |
|
|
346
|
|
|
|
|
1624
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub add_bulk { |
|
61
|
1861
|
|
|
1861
|
1
|
3081
|
my $self = shift; |
|
62
|
1861
|
|
|
|
|
2682
|
my $default = shift; |
|
63
|
|
|
|
|
|
|
|
|
64
|
1861
|
|
|
|
|
3613
|
my $pkg = $self->{+PACKAGE}; |
|
65
|
|
|
|
|
|
|
|
|
66
|
1861
|
|
|
|
|
4018
|
for my $name (@_) { |
|
67
|
|
|
|
|
|
|
confess "$name is already exported" |
|
68
|
11942
|
100
|
|
|
|
27838
|
if $self->{+EXPORTS}->{$name}; |
|
69
|
|
|
|
|
|
|
|
|
70
|
109
|
|
|
109
|
|
577
|
no strict 'refs'; |
|
|
109
|
|
|
|
|
256
|
|
|
|
109
|
|
|
|
|
12782
|
|
|
71
|
|
|
|
|
|
|
$self->{+EXPORTS}->{$name} = *{"$pkg\::$name"}{CODE} |
|
72
|
11941
|
|
66
|
|
|
13125
|
|| confess "No reference or package sub found for '$name' in '$pkg'"; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
1859
|
100
|
|
|
|
6456
|
push @{$self->{+DEFAULT}} => @_ if $default; |
|
|
826
|
|
|
|
|
4491
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |