line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package No::Die; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
118278
|
use Carp qw[carp croak]; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
217
|
|
4
|
2
|
|
|
2
|
|
2105
|
use Params::Check qw[check]; |
|
2
|
|
|
|
|
12018
|
|
|
2
|
|
|
|
|
200
|
|
5
|
2
|
|
|
2
|
|
23
|
use Locale::Maketext::Simple Style => 'gettext'; |
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1198
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
83
|
|
8
|
2
|
|
|
2
|
|
10
|
use vars qw[$DIE $VERSION]; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
175
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$VERSION = 0.02; |
11
|
|
|
|
|
|
|
|
12
|
2
|
|
|
2
|
|
587
|
BEGIN { *CORE::GLOBAL::die = sub { goto &_nodie } } |
|
3
|
|
|
3
|
|
1211
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my $Store = { files => [ ], packages => [ ] }; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
### for debugging purposes only ### |
17
|
0
|
|
|
0
|
|
0
|
sub _store { return $Store }; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub import { |
20
|
2
|
|
|
2
|
|
21
|
my $self = shift; |
21
|
2
|
|
|
|
|
6
|
my ($pkg,$file) = caller; |
22
|
|
|
|
|
|
|
|
23
|
2
|
100
|
|
|
|
13
|
if( @_ ) { |
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
|
|
5
|
my $tmpl = { |
26
|
|
|
|
|
|
|
files => { default => [ ], strict_type => 1 }, |
27
|
|
|
|
|
|
|
packages => { default => [ ], strict_type => 1 }, |
28
|
|
|
|
|
|
|
}; |
29
|
|
|
|
|
|
|
|
30
|
1
|
|
|
|
|
3
|
local $Params::Check::VERBOSE = 1; |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
17
|
my $args = check( $tmpl, { @_ } ) |
33
|
|
|
|
|
|
|
or die qq[Improper arguments!]; |
34
|
|
|
|
|
|
|
|
35
|
1
|
|
|
|
|
82
|
for( keys %$args ) { |
36
|
2
|
|
|
|
|
3
|
push @{$Store->{$_}}, @{$args->{$_}}; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
9
|
|
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
40
|
2
|
|
|
|
|
4
|
push @{$Store->{files}}, $file, $INC{'No/Die.pm'}; |
|
2
|
|
|
|
|
8
|
|
41
|
2
|
|
|
|
|
5
|
push @{$Store->{packages}}, $pkg, __PACKAGE__; |
|
2
|
|
|
|
|
6
|
|
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
2
|
|
13
|
{ no strict 'refs'; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
569
|
|
|
2
|
|
|
|
|
3
|
|
44
|
2
|
|
|
|
|
4
|
*{"${pkg}::DIE"} = *DIE; |
|
2
|
|
|
|
|
39
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _nodie { |
49
|
3
|
|
|
3
|
|
8
|
my @call; my $flag; |
50
|
3
|
|
|
|
|
16
|
my ($pkg) = @call = caller; |
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
7
|
local $Params::Check::VERBOSE = 0; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
### sort is important, because of caller order ### |
55
|
3
|
|
|
|
|
24
|
for my $key ( reverse sort keys %$Store ) { |
56
|
6
|
100
|
|
|
|
388
|
$flag++ if check( |
57
|
|
|
|
|
|
|
{ $key => { allow => $Store->{$key} } }, |
58
|
|
|
|
|
|
|
{ $key => shift @call }, |
59
|
|
|
|
|
|
|
); |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
|
62
|
3
|
100
|
|
|
|
334
|
if( $flag ) { |
63
|
2
|
|
|
|
|
4
|
$DIE = undef; |
64
|
2
|
|
|
|
|
392
|
croak(@_); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} else { |
67
|
1
|
50
|
|
|
|
6
|
carp loc(q[Unallowed '%1' requested from package '%2'], 'die', $pkg) if $^W; |
68
|
1
|
|
|
|
|
4
|
$DIE = "@_"; |
69
|
1
|
|
|
|
|
4
|
return undef; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |