line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Anansi::ScriptComponent; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=head1 NAME |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
Anansi::ScriptComponent - A manager template for Perl script interface interactions. |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 SYNOPSIS |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
package Anansi::Script::Example; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use base qw(Anansi::ScriptComponent); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub validate { |
15
|
|
|
|
|
|
|
my ($self, $channel, %parameters) = @_; |
16
|
|
|
|
|
|
|
return $self->SUPER::validate(undef); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Anansi::ScriptComponent::addChannel('Anansi::Script::Example', 'VALIDATE_AS_APPROPRIATE' => 'validate'); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
1; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Manages a Perl script's interface interactions with the user providing generic |
26
|
|
|
|
|
|
|
processes to co-ordinate execution argument access and verification and the |
27
|
|
|
|
|
|
|
correct output of concurrent script responses. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
1
|
|
70118
|
use base qw(Anansi::Component); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
536
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 INHERITED METHODS |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 addChannel |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
Declared in L. Overridden by this module. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub addChannel { |
50
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
51
|
0
|
|
|
|
|
|
return $self->SUPER::addChannel((%parameters)); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 channel |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Declared in L. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 componentManagers |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Declared in L. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 finalise |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
$OBJECT->SUPER::finalise(); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
$OBJECT->Anansi::Class::finalise(); |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Declared as a virtual method in L. Overridden by this module. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub finalise { |
81
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 implicate |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Declared as a virtual method in L. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=cut |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 import |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Declared in L. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=cut |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 initialise |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
$OBJECT->SUPER::initialise(); |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Declared as a virtual method in L. Overridden by this module. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=cut |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub initialise { |
109
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head2 old |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Declared in L. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 removeChannel |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Declared in L. Overridden by this module. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=cut |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub removeChannel { |
128
|
0
|
|
|
0
|
1
|
|
my ($self, %parameters) = @_; |
129
|
0
|
|
|
|
|
|
return $self->SUPER::removeChannel((%parameters)); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head2 used |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Declared in L. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 uses |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Declared in L. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=cut |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 METHODS |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=cut |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 validate |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
if(1 == Anansi::ScriptComponent::validate($OBJECT, undef)); |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
if(1 == Anansi::ScriptComponent::channel($OBJECT, 'VALIDATE_AS_APPROPRIATE')); |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
if(1 == Anansi::ScriptComponent->validate(undef)); |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
if(1 == Anansi::ScriptComponent->channel('VALIDATE_AS_APPROPRIATE')); |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
if(1 == $OBJECT->validate(undef)); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
if(1 == $OBJECT->channel('VALIDATE_AS_APPROPRIATE')); |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item self I<(Blessed Hash B String, Required)> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Either an object or a string of this namespace. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item channel I<(String, Required)> |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
The abstract identifier of a subroutine. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item parameters I<(Hash, Optional)> |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Named parameters. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=back |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Generic validation for whether a Perl script should be handled by a component. |
183
|
|
|
|
|
|
|
Returns B<1> I<(one)> for yes and B<0> I<(zero)> for no. |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=cut |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub validate { |
189
|
0
|
|
|
0
|
1
|
|
my ($self, $channel, %parameters) = @_; |
190
|
0
|
|
|
|
|
|
my $package = $self; |
191
|
0
|
0
|
|
|
|
|
$package = ref($self) if(ref($self) !~ /^$/); |
192
|
0
|
|
|
|
|
|
return 1; |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
Anansi::Component::addChannel('Anansi::ScriptComponent', 'VALIDATE_AS_APPROPRIATE' => 'validate'); |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
=head1 METHODS |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=head1 NOTES |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
This module is designed to make it simple, easy and quite fast to code your |
206
|
|
|
|
|
|
|
design in perl. If for any reason you feel that it doesn't achieve these goals |
207
|
|
|
|
|
|
|
then please let me know. I am here to help. All constructive criticisms are |
208
|
|
|
|
|
|
|
also welcomed. |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=cut |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 AUTHOR |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
Kevin Treleaven treleaven I net> |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=cut |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
1; |
221
|
|
|
|
|
|
|
|