| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package custom::failures::x::alias; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: export aliases for custom::failures |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
227951
|
use v5.10.0; |
|
|
1
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
19
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
448
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub _croak { |
|
13
|
0
|
|
|
0
|
|
0
|
require Carp; |
|
14
|
0
|
|
|
|
|
0
|
goto \&Carp::croak; |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub _alias { |
|
18
|
5
|
|
|
5
|
|
13
|
my ( $failure, $opt ) = @_; |
|
19
|
5
|
|
|
|
|
11
|
$failure =~ s/::/_/g; |
|
20
|
5
|
|
50
|
|
|
41
|
return ($opt->{-prefix} // '') . $failure . ($opt->{-suffix} // '') ; |
|
|
|
|
50
|
|
|
|
|
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub import { |
|
24
|
4
|
|
|
4
|
|
13876
|
my ( $class, @failures ) = @_; |
|
25
|
4
|
|
|
|
|
10
|
my $caller; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# mimic what failures::import does to allow specifying the caller |
|
28
|
4
|
100
|
|
|
|
15
|
if ( 'ARRAY' eq ref $failures[1] ) { |
|
29
|
3
|
|
|
|
|
8
|
$caller = shift @failures; |
|
30
|
3
|
|
|
|
|
6
|
@failures = @{ $failures[0] }; |
|
|
3
|
|
|
|
|
9
|
|
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
else { |
|
33
|
1
|
|
|
|
|
3
|
$caller = caller; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
9
|
my $export = 'EXPORT_OK'; |
|
37
|
4
|
|
|
|
|
7
|
my $exporter = 'Exporter'; |
|
38
|
4
|
|
|
|
|
10
|
my $alias = \&_alias; |
|
39
|
4
|
|
|
|
|
7
|
my %opt; |
|
40
|
|
|
|
|
|
|
|
|
41
|
4
|
|
66
|
|
|
31
|
while ( @failures && substr( $failures[0], 0, 1 ) eq '-' ) { |
|
42
|
2
|
|
|
|
|
5
|
my $opt = shift @failures; |
|
43
|
|
|
|
|
|
|
|
|
44
|
2
|
50
|
|
|
|
16
|
if ( $opt eq '-prefix' ) { |
|
|
|
50
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
45
|
0
|
|
0
|
|
|
0
|
$opt{prefix} = shift( @failures ) |
|
46
|
|
|
|
|
|
|
// _croak( "missing value for -prefix" ); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
elsif ( $opt eq '-suffix' ) { |
|
50
|
0
|
|
0
|
|
|
0
|
$opt{suffix} = shift( @failures ) |
|
51
|
|
|
|
|
|
|
// _croak( "missing value for -suffix" ); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
elsif ( $opt eq '-alias' ) { |
|
55
|
0
|
|
0
|
|
|
0
|
$alias = shift( @failures ) // _croak( "missing value for -alias" ); |
|
56
|
0
|
0
|
|
|
|
0
|
'CODE' eq ref $alias |
|
57
|
|
|
|
|
|
|
or _croak( "-alias must be a coderef" ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
elsif ( $opt eq '-export' ) { |
|
61
|
1
|
|
|
|
|
5
|
$export = 'EXPORT'; |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
elsif ( $opt eq '-exporter' ) { |
|
65
|
1
|
|
33
|
|
|
4
|
$exporter = shift( @failures ) |
|
66
|
|
|
|
|
|
|
// _croak( "missing value for -exporter" ); |
|
67
|
1
|
50
|
|
1
|
|
7
|
eval "use $exporter ; 1 " ## no critic (ProhibitStringyEval) |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
70
|
|
|
68
|
|
|
|
|
|
|
|| _croak( |
|
69
|
|
|
|
|
|
|
"requested exporter '$exporter' cannot be loaded: $@" ); |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
4
|
|
|
|
|
520
|
require custom::failures; |
|
76
|
4
|
|
|
|
|
5430
|
custom::failures->import( $caller => \@failures ); |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
{ |
|
79
|
1
|
|
|
1
|
|
9
|
no strict 'refs'; ## no critic (ProhibitNoStrict) |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
306
|
|
|
|
4
|
|
|
|
|
362
|
|
|
80
|
|
|
|
|
|
|
|
|
81
|
4
|
|
|
|
|
8
|
my @export; |
|
82
|
4
|
|
|
|
|
9
|
for my $failure ( @failures ) { |
|
83
|
5
|
|
|
|
|
16
|
my $alias = $alias->( $failure, \%opt ); |
|
84
|
5
|
|
|
|
|
13
|
push @export, $alias; |
|
85
|
5
|
|
|
|
|
12
|
my $fqn = "${caller}::${alias}"; |
|
86
|
9
|
|
|
9
|
|
19504
|
*$fqn = sub () { "${caller}::${failure}" } |
|
87
|
5
|
|
|
|
|
47
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
4
|
100
|
|
|
|
14
|
if ( $exporter eq 'Exporter' ) { |
|
90
|
3
|
|
|
|
|
17
|
require Exporter; |
|
91
|
3
|
|
|
|
|
8
|
my $fqn = "${caller}::import"; |
|
92
|
3
|
|
|
|
|
14
|
*$fqn = \&Exporter::import; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
else { |
|
95
|
1
|
|
|
|
|
3
|
my $fqn = "${caller}::ISA"; |
|
96
|
1
|
|
50
|
|
|
2
|
my $ISA = *{$fqn}{ARRAY} // ( *$fqn = [] ); |
|
|
1
|
|
|
|
|
6
|
|
|
97
|
1
|
|
|
|
|
17
|
push @$ISA, $exporter; |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
{ |
|
101
|
4
|
|
|
|
|
10
|
my $fqn = "${caller}::${export}"; |
|
102
|
4
|
|
50
|
|
|
7
|
my $export = *{$fqn}{ARRAY} // ( *$fqn = [] ); |
|
|
4
|
|
|
|
|
34
|
|
|
103
|
4
|
|
|
|
|
15
|
push @$export, @export; |
|
104
|
|
|
|
|
|
|
} |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
{ |
|
107
|
4
|
|
|
|
|
11
|
my $fqn = "${caller}::EXPORT_TAGS"; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
10
|
|
|
108
|
4
|
|
50
|
|
|
7
|
my $tags = *{$fqn}{HASH} // ( *$fqn = {} ); |
|
|
4
|
|
|
|
|
31
|
|
|
109
|
4
|
|
50
|
|
|
7
|
push @{ $tags->{all} //= [] }, @export; |
|
|
4
|
|
|
|
|
25
|
|
|
110
|
|
|
|
|
|
|
} |
|
111
|
|
|
|
|
|
|
} |
|
112
|
|
|
|
|
|
|
|
|
113
|
4
|
|
|
|
|
3119
|
return; |
|
114
|
|
|
|
|
|
|
} |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
# |
|
119
|
|
|
|
|
|
|
# This file is part of custom-failures-x-alias |
|
120
|
|
|
|
|
|
|
# |
|
121
|
|
|
|
|
|
|
# This software is Copyright (c) 2021 by Smithsonian Astrophysical Observatory. |
|
122
|
|
|
|
|
|
|
# |
|
123
|
|
|
|
|
|
|
# This is free software, licensed under: |
|
124
|
|
|
|
|
|
|
# |
|
125
|
|
|
|
|
|
|
# The GNU General Public License, Version 3, June 2007 |
|
126
|
|
|
|
|
|
|
# |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |