line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Undead; |
2
|
2
|
|
|
2
|
|
33024
|
use 5.008001; |
|
2
|
|
|
|
|
7
|
|
3
|
2
|
|
|
2
|
|
10
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
34
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
168
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=encoding utf-8 |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Acme::Undead - The Undead is not die! |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
use Acme::Undead; |
17
|
|
|
|
|
|
|
die('undead is not die'); |
18
|
|
|
|
|
|
|
print 'Hell world'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#Hell world |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
no Acme::Undead; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
die() #died; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Acme::Undead is export routines, die(), bless() and sleep(). |
29
|
|
|
|
|
|
|
Use Acme::Undead when dont die at die(), die at bless() and not sleep at sleep(). |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 OVERRIDE METHODS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head2 die |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
undead is not die! |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 sleep |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
undead is not sleeping |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 bless |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
the god bless clean undead auras. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
our @EXPORT = qw/die sleep bless/; |
48
|
|
|
|
|
|
|
our $IS_UNDEAD = 0; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub import { |
51
|
2
|
|
|
2
|
|
16
|
my $class = shift; |
52
|
2
|
|
|
|
|
4
|
my $caller = shift; |
53
|
2
|
|
|
|
|
8
|
$^H{acme_undead} = 1; |
54
|
2
|
|
|
|
|
4
|
$IS_UNDEAD = 1; |
55
|
|
|
|
|
|
|
{ |
56
|
2
|
|
|
2
|
|
10
|
no strict 'refs'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
44
|
|
|
2
|
|
|
|
|
4
|
|
57
|
2
|
|
|
2
|
|
7
|
no warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
652
|
|
58
|
2
|
|
|
|
|
6
|
for my $func (@EXPORT) { |
59
|
6
|
|
|
|
|
15
|
my $local_func = "_" . $func; |
60
|
6
|
|
|
|
|
9
|
*{"${caller}::$func"} = *{"Acme::Undead::$local_func"}; |
|
6
|
|
|
|
|
101
|
|
|
6
|
|
|
|
|
21
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub unimport { |
66
|
2
|
|
|
2
|
|
2055
|
$^H{acme_undead} = 0; |
67
|
2
|
|
|
|
|
2014
|
$IS_UNDEAD = 0; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub _die { |
71
|
2
|
|
|
2
|
|
2438
|
my $class = shift; |
72
|
2
|
|
|
|
|
9
|
my $hinthash = (caller(0))[10]; |
73
|
2
|
100
|
|
|
|
179
|
return $hinthash->{acme_undead} ? undef : die(shift); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub _sleep { |
77
|
0
|
|
|
0
|
|
|
my $hinthash = (caller(0))[10]; |
78
|
0
|
0
|
|
|
|
|
return $hinthash->{acme_undead} ? undef : sleep(shift); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub _bless { |
82
|
0
|
|
|
0
|
|
|
my $hinthash = (caller(0))[10]; |
83
|
0
|
0
|
|
|
|
|
return $hinthash->{acme_undead} ? die('blessed') : do { |
84
|
0
|
|
|
|
|
|
my $arg = shift; |
85
|
0
|
|
0
|
|
|
|
my $pkg = shift || (caller(0))[0]; |
86
|
0
|
|
|
|
|
|
bless($arg, $pkg); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub END { |
91
|
2
|
50
|
|
2
|
|
1739
|
return unless $IS_UNDEAD; |
92
|
0
|
|
|
|
|
0
|
my @signals = keys %SIG; |
93
|
0
|
|
|
|
|
0
|
my $pid = fork(); |
94
|
0
|
0
|
|
|
|
0
|
if ($pid){ |
95
|
0
|
|
|
|
|
0
|
local %SIG; |
96
|
0
|
|
|
|
|
0
|
for my $sig (@signals){ |
97
|
|
|
|
|
|
|
$SIG{$sig} = sub { |
98
|
0
|
|
|
|
|
0
|
warn 'undead is die'; |
99
|
0
|
|
|
|
|
0
|
}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
$SIG{USR1} = sub { |
102
|
0
|
|
|
|
|
0
|
$IS_UNDEAD = 0; |
103
|
0
|
|
|
|
|
0
|
}; |
104
|
0
|
|
|
|
|
0
|
while($IS_UNDEAD){ sleep 1; } |
|
0
|
|
|
|
|
0
|
|
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
else { |
107
|
0
|
|
|
|
|
0
|
exit; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |
112
|
|
|
|
|
|
|
__END__ |