line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: TSTP.pm,v 1.3 2002/12/17 18:10:21 matt Exp $ |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package POE::Component::TSTP; |
4
|
1
|
|
|
1
|
|
7969
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
51
|
|
5
|
1
|
|
|
1
|
|
1271
|
use POE; |
|
1
|
|
|
|
|
55794
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
100117
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
256
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub create { |
11
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
12
|
0
|
|
|
|
|
|
my %args = @_; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
POE::Session->create( |
15
|
|
|
|
|
|
|
inline_states => { |
16
|
|
|
|
|
|
|
_start => \&new, |
17
|
|
|
|
|
|
|
sigtstp => \&sigtstp, |
18
|
|
|
|
|
|
|
}, |
19
|
|
|
|
|
|
|
args => [ $args{Alias}, $args{PreSuspend}, $args{PostSuspend} ], |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub new { |
24
|
0
|
|
|
0
|
0
|
|
my ($kernel, $heap, $alias, $pre, $post) = |
25
|
|
|
|
|
|
|
@_[KERNEL, HEAP, ARG0, ARG1, ARG2]; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$kernel->sig(TSTP => 'sigtstp'); |
28
|
0
|
|
0
|
|
|
|
$kernel->alias_set($alias || 'tstp_handler'); |
29
|
0
|
|
|
|
|
|
$heap->{PreSuspend} = $pre; |
30
|
0
|
|
|
|
|
|
$heap->{PostSuspend} = $post; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub sigtstp { |
34
|
0
|
0
|
|
0
|
0
|
|
$_[HEAP]->{PreSuspend}->(@_) if $_[HEAP]->{PreSuspend}; |
35
|
0
|
|
|
|
|
|
local $SIG{TSTP} = 'DEFAULT'; |
36
|
0
|
|
|
|
|
|
kill(TSTP => $$); |
37
|
0
|
|
|
|
|
|
$_[KERNEL]->sig_handled(); |
38
|
0
|
0
|
|
|
|
|
$_[HEAP]->{PostSuspend}->(@_) if $_[HEAP]->{PostSuspend}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
__END__ |