line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Slides::Controller::Single; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
|
4
|
18
|
|
|
18
|
|
50295
|
use version; our $VERSION = qv('0.0.9'); |
|
18
|
|
|
|
|
14262
|
|
|
18
|
|
|
|
|
123
|
|
5
|
|
|
|
|
|
|
|
6
|
18
|
|
|
18
|
|
1672
|
use warnings; |
|
18
|
|
|
|
|
32
|
|
|
18
|
|
|
|
|
573
|
|
7
|
18
|
|
|
18
|
|
95
|
use strict; |
|
18
|
|
|
|
|
31
|
|
|
18
|
|
|
|
|
570
|
|
8
|
18
|
|
|
18
|
|
100
|
use Carp; |
|
18
|
|
|
|
|
40
|
|
|
18
|
|
|
|
|
1475
|
|
9
|
18
|
|
|
18
|
|
6950
|
use English qw( -no_match_vars ); |
|
18
|
|
|
|
|
22245
|
|
|
18
|
|
|
|
|
128
|
|
10
|
|
|
|
|
|
|
|
11
|
18
|
|
|
18
|
|
20647
|
use Object::InsideOut qw( WWW::Slides::Controller ); |
|
18
|
|
|
|
|
518758
|
|
|
18
|
|
|
|
|
155
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Module implementation here |
14
|
|
|
|
|
|
|
my @in_handle : Field # controller handle |
15
|
|
|
|
|
|
|
: Std(Name => 'in_handle', Private => 1) |
16
|
|
|
|
|
|
|
: Arg(Name => 'in_handle', Mandatory => 1); |
17
|
|
|
|
|
|
|
my @out_handle : Field : Std(Name => 'out_handle', Private => 1) |
18
|
|
|
|
|
|
|
: Arg(Name => 'out_handle'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub is_alive { |
21
|
63
|
|
|
63
|
1
|
3808
|
my $self = shift; |
22
|
63
|
|
|
|
|
1460
|
return defined($self->get_in_handle()); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub shut_down { |
26
|
2
|
|
|
2
|
1
|
1762
|
my $self = shift; |
27
|
2
|
50
|
|
|
|
54
|
$self->release_selector() if $self->selector(); |
28
|
2
|
50
|
|
|
|
44
|
$self->get_in_handle()->close() if $self->get_in_handle(); |
29
|
2
|
|
|
|
|
535
|
$self->set_in_handle(undef); |
30
|
2
|
100
|
|
|
|
188
|
$self->get_out_handle()->close() if $self->get_out_handle(); |
31
|
2
|
|
|
|
|
267
|
$self->set_out_handle(undef); |
32
|
2
|
|
|
|
|
132
|
return; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub set_selector { |
36
|
5
|
|
|
5
|
1
|
1048
|
my ($self, $selector) = @_; |
37
|
5
|
50
|
|
|
|
23
|
$selector->add($self->get_in_handle()) if $self->is_alive(); |
38
|
4
|
|
|
|
|
728
|
$self->SUPER::set_selector($selector); |
39
|
4
|
|
|
|
|
28
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub release_selector { |
43
|
3
|
|
|
3
|
1
|
1465
|
my $self = shift; |
44
|
3
|
50
|
|
|
|
9
|
return unless $self->is_alive(); |
45
|
3
|
|
|
|
|
248
|
$self->selector()->remove($self->get_in_handle()); |
46
|
3
|
|
|
|
|
226
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub owns { |
50
|
3
|
|
|
3
|
1
|
1390
|
my $self = shift; |
51
|
3
|
|
|
|
|
5
|
my ($fh) = @_; |
52
|
3
|
50
|
|
|
|
8
|
return unless $self->is_alive(); |
53
|
3
|
100
|
|
|
|
137
|
return unless defined $fh; |
54
|
2
|
|
|
|
|
46
|
return $self->get_in_handle() == $fh; |
55
|
|
|
|
|
|
|
} ## end sub owns |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub output { |
58
|
24
|
|
|
24
|
1
|
3058
|
my $self = shift; |
59
|
24
|
100
|
|
|
|
49
|
croak 'object is not alive, no output possible' |
60
|
|
|
|
|
|
|
unless $self->is_alive(); |
61
|
23
|
50
|
|
|
|
1689
|
my $fh = $self->get_out_handle() or return; |
62
|
23
|
|
|
|
|
1186
|
print {$fh} @_; |
|
23
|
|
|
|
|
137
|
|
63
|
23
|
|
|
|
|
67
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get_input_chunk { |
67
|
21
|
|
|
21
|
0
|
17
|
my $self = shift; |
68
|
21
|
50
|
|
|
|
35
|
croak 'not alive, cannot input' unless $self->is_alive(); |
69
|
21
|
|
|
|
|
1557
|
$self->get_in_handle()->sysread(my $newstuff, 4096); |
70
|
21
|
50
|
33
|
|
|
1366
|
return unless defined $newstuff and length $newstuff; |
71
|
21
|
|
|
|
|
84
|
return $newstuff; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
76
|
|
|
|
|
|
|
__END__ |