line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::Slides::Controller::Multiple; |
2
|
|
|
|
|
|
|
{ |
3
|
|
|
|
|
|
|
|
4
|
11
|
|
|
11
|
|
39696
|
use version; our $VERSION = qv('0.0.9'); |
|
11
|
|
|
|
|
10908
|
|
|
11
|
|
|
|
|
72
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
1142
|
use warnings; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
349
|
|
7
|
11
|
|
|
11
|
|
58
|
use strict; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
329
|
|
8
|
11
|
|
|
11
|
|
68
|
use Carp; |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
855
|
|
9
|
|
|
|
|
|
|
|
10
|
11
|
|
|
11
|
|
6276
|
use Object::InsideOut qw( WWW::Slides::Controller ); |
|
11
|
|
|
|
|
311641
|
|
|
11
|
|
|
|
|
106
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Other recommended modules (uncomment to use): |
13
|
|
|
|
|
|
|
# use IO::Prompt; |
14
|
|
|
|
|
|
|
# use Perl6::Export; |
15
|
|
|
|
|
|
|
# use Perl6::Slurp; |
16
|
|
|
|
|
|
|
# use Perl6::Say; |
17
|
|
|
|
|
|
|
# use Regexp::Autoflags; |
18
|
|
|
|
|
|
|
# use Readonly; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Module implementation here |
21
|
|
|
|
|
|
|
my @controllers : Field # Repository for handles |
22
|
|
|
|
|
|
|
: Std(Name => 'controllers', Private => 1) |
23
|
|
|
|
|
|
|
: Get(Name => 'controllers', Private => 1); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _init : Init { |
26
|
11
|
|
|
|
|
125
|
my $self = shift; |
27
|
11
|
|
|
|
|
308
|
$self->set_controllers([]); |
28
|
11
|
|
|
11
|
|
2793
|
} |
|
11
|
|
|
|
|
19
|
|
|
11
|
|
|
|
|
69
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub is_alive { |
31
|
5
|
|
|
5
|
1
|
3019
|
my $self = shift; |
32
|
5
|
|
|
|
|
9
|
$self->remove(grep { ! $_->is_alive() } @{ $self->controllers() }); |
|
0
|
|
|
|
|
0
|
|
|
5
|
|
|
|
|
131
|
|
33
|
5
|
|
|
|
|
45
|
return 1; # By definition |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub shut_down { |
37
|
1
|
|
|
1
|
1
|
1346
|
my $self = shift; |
38
|
1
|
|
|
|
|
4
|
$self->release_selector(); |
39
|
1
|
|
|
|
|
9
|
$self->SUPER::shut_down(); |
40
|
1
|
|
|
|
|
4
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub add { |
44
|
9
|
|
|
9
|
0
|
2104
|
my $self = shift; |
45
|
9
|
|
|
|
|
273
|
my $selector = $self->selector(); |
46
|
9
|
|
|
|
|
262
|
my $controllers = $self->controllers(); |
47
|
9
|
|
|
|
|
655
|
for my $controller (@_) { |
48
|
10
|
|
|
|
|
19
|
push @$controllers, $controller; |
49
|
10
|
100
|
|
|
|
54
|
$controller->set_selector($selector) if $selector; |
50
|
|
|
|
|
|
|
} |
51
|
9
|
|
|
|
|
184
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub remove { |
55
|
8
|
|
|
8
|
0
|
1731
|
my $self = shift; |
56
|
8
|
|
|
|
|
210
|
my $selector = $self->selector(); |
57
|
8
|
|
|
|
|
45
|
my @remaining = @{$self->controllers()}; |
|
8
|
|
|
|
|
275
|
|
58
|
8
|
|
|
|
|
374
|
for my $controller (@_) { |
59
|
3
|
|
|
|
|
5
|
@remaining = grep { $_ ne $controller } @remaining; |
|
4
|
|
|
|
|
22
|
|
60
|
3
|
100
|
|
|
|
19
|
$controller->release_selector($selector) if $selector; |
61
|
|
|
|
|
|
|
} |
62
|
8
|
|
|
|
|
217
|
$self->set_controllers(\@remaining); |
63
|
8
|
|
|
|
|
363
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub set_selector { |
67
|
6
|
|
|
6
|
1
|
1244
|
my $self = shift; |
68
|
6
|
|
|
|
|
13
|
my ($selector) = @_; |
69
|
6
|
|
|
|
|
414
|
$self->SUPER::set_selector($selector); |
70
|
6
|
100
|
|
|
|
41
|
$_->set_selector($selector) for @{ $self->controllers() || [] }; |
|
6
|
|
|
|
|
162
|
|
71
|
6
|
|
|
|
|
557
|
return; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub release_selector { |
75
|
5
|
|
|
5
|
1
|
1603
|
my $self = shift; |
76
|
5
|
50
|
|
|
|
277
|
my $selector = $self->selector() or return; |
77
|
5
|
50
|
|
|
|
46
|
$_->release_selector($selector) for @{ $self->controllers() || [] }; |
|
5
|
|
|
|
|
266
|
|
78
|
5
|
|
|
|
|
719
|
$self->SUPER::release_selector(); |
79
|
5
|
|
|
|
|
16
|
return; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub owns { |
83
|
4
|
|
|
4
|
1
|
782
|
my $self = shift; |
84
|
4
|
|
|
|
|
7
|
my ($fh) = @_; |
85
|
4
|
|
|
|
|
24
|
return defined $self->get_owner($fh); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# get_input_chunk not overridden, cannot be called |
89
|
|
|
|
|
|
|
# output not overridden, cannot be called |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub get_owner : Private { |
92
|
6
|
|
|
|
|
201
|
my $self = shift; |
93
|
6
|
|
|
|
|
11
|
my ($fh) = @_; |
94
|
6
|
|
|
|
|
9
|
for my $c (@{ $self->controllers() }) { |
|
6
|
|
|
|
|
154
|
|
95
|
5
|
100
|
|
|
|
271
|
return $c if $c->owns($fh); |
96
|
|
|
|
|
|
|
} |
97
|
2
|
|
|
|
|
102
|
return; |
98
|
11
|
|
|
11
|
|
8948
|
} |
|
11
|
|
|
|
|
28
|
|
|
11
|
|
|
|
|
1433
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub execute_commands { # Get commands from applicable component |
101
|
2
|
|
|
2
|
1
|
569
|
my $self = shift; |
102
|
2
|
|
|
|
|
12
|
my ($fh, $talk) = @_; |
103
|
2
|
|
|
|
|
12
|
return $self->get_owner($fh)->execute_commands($fh, $talk); |
104
|
|
|
|
|
|
|
} ## end sub get_commands |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
108
|
|
|
|
|
|
|
__END__ |