GX/Component.pm

filter: Statementstmt 34.0% 78 / 229 Branchbran 14.8% 14 / 94 Conditioncond 13.7% 4 / 29 MC/DCmcdc 5.5% 1 / 18 Subroutinesub 41.6% 15 / 36 Podpod 100% 1 / 1 totaltotal 27.7% 113 / 407 CC 63 SCAR 29.6
CC
63
Cov
27%
__setup
56.0
_export_attribute
56.0
__register
42.0
CRAP 19.2
« GX/Meta/Util.pm ↑ Summary GX/HTTP/Response/Cookie.pm »
1 # ----------------------------------------------------------------------------------------------------------------------
2 # GX Framework (c) 2009-2011 Jörg A. Uzarek <uzarek@runlevelnull.de>
3 # File: GX/Component.pm
4 # ----------------------------------------------------------------------------------------------------------------------
5  
6 package GX::Component;
7  
8 50 ▶use GX::Callback::Method;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 50 ▶use GX::Exception;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 50 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 # ----------------------------------------------------------------------------------------------------------------------
15 # Constants
16 # ----------------------------------------------------------------------------------------------------------------------
17  
18 50 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
19 50 STATE_RELOADING => -1,
20 STATE_INITIALIZED => 0,
21 STATE_SETUP => 1,
22 STATE_DEPLOYED => 2,
23 STATE_RUNNING => 3
24 50 };
25  
26  
27 # ----------------------------------------------------------------------------------------------------------------------
28 # Class setup
29 # ----------------------------------------------------------------------------------------------------------------------
30  
31 50 ▶use GX::Class ( code_attributes => [ 'Handler' ] );
Subroutine BEGIN: called CC=1 SCAR=0.0
32  
33 50 has static 'application' => (
34 isa => 'Scalar',
35 weaken => 1,
36 accessors => {
37 'application' => { type => 'get' },
38 '_set_application' => { type => 'set' }
39 }
40 );
41  
42 50 has static 'component_state' => (
43 isa => 'Scalar',
44 default => STATE_INITIALIZED,
45 accessors => {
46 '_get_component_state' => { type => 'get' },
47 '_set_component_state' => { type => 'set' }
48 }
49 );
50  
51 50 has static 'config' => (
52 isa => 'Hash',
53 initializer => '_initialize_config',
54 accessors => {
55 '_get_config' => { type => 'get_reference' }
56 }
57 );
58  
59 50 has static 'handlers' => (
60 isa => 'Hash',
61 accessors => {
62 '_get_handlers' => { type => 'get_reference' }
63 }
64 );
65  
66 50 build;
67  
68  
69 # ----------------------------------------------------------------------------------------------------------------------
70 # Public methods
71 # ----------------------------------------------------------------------------------------------------------------------
72  
73 7 ▶sub setup {
Subroutine setup: called CC=5 SCAR=18.5
Pod documented
74  
75 7 my $class = shift;
76  
77 7 ▶ if ( ref $class ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $class) 0 7 7
78 0 complain "setup() is a class method";
79 }
80  
81 7 ▶ if ( @_ % 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ % 2) 0 7 7
82 0 complain "Invalid number of arguments";
83 }
84  
85 7 ▶ if ( $class->_is_setup ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->_is_setup) 0 7 7
86 0 complain "$class has already been setup";
87 }
88  
89 7 eval {
90 7 $class->_component_interface->_setup( { @_ } );
91 };
92  
93 7 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 7 7
94 0 GX::Exception->complain(
95 message => "$class setup failed",
96 subexception => $@
97 );
98 }
99  
100 7 $class->_is_setup( 1 );
101  
102 7 return;
103  
104 }
105  
106  
107 # ----------------------------------------------------------------------------------------------------------------------
108 # Internal methods
109 # ----------------------------------------------------------------------------------------------------------------------
110  
111 0 ▶sub __deploy {
Subroutine __deploy: not called CC=4 SCAR=30.0
112  
113 0 my $class = shift;
114  
115 0 ▶ if ( $class->_is_deployed ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->_is_deployed) 0 0 0
116 0 return;
117 }
118  
119 0 ▶ if ( ! $class->application ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->application) 0 0 0
120 0 complain "Cannot deploy $class (component has not been registered)";
121 }
122  
123 0 eval {
124 0 $class->_component_interface->_deploy;
125 };
126  
127 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
128 0 GX::Exception->complain(
129 message => "Cannot deploy $class",
130 subexception => $@
131 );
132 }
133  
134 0 $class->_is_deployed( 1 );
135  
136 0 return;
137  
138 }
139  
140 0 ▶sub __register {
Subroutine __register: not called CC=6 SCAR=37.4
141  
142 0 my $class = shift;
143 0 my $application = shift;
144  
145 0 ▶ if ( ! blessed $application || ! $application->isa( 'GX::Application' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($application) and $application->isa("GX::Application")) 0 0 0
Condition0%0/3
builtin::blessed($application) and $application->isa("GX::Application")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($application) and $application->isa("GX::Application")
builtin::blessed($application) $application->isa("GX::Application")
Truth table0%0/3
A and B
A= builtin::blessed($application)B= $application->isa("GX::Application")
ABresult
0X0
100
111
146 0 complain "Invalid argument";
147 }
148  
149 0 ▶ if ( $class->application ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->application) 0 0 0
150  
151 0 ▶ if ( $class->application == $application ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->application == $application) { } 0 0 0
152 0 return $class->_component_interface;
153 }
154 else {
155 0 complain "Cannot register $class (already registered)";
156 }
157  
158 }
159  
160 0 $class->__setup;
161  
162 0 eval {
163 0 $class->_component_interface->_register( $application );
164 };
165  
166 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
167 0 GX::Exception->complain(
168 message => "Cannot register $class",
169 subexception => $@
170 );
171 }
172  
173 0 return $class->_component_interface;
174  
175 }
176  
177 0 ▶sub __setup {
Subroutine __setup: not called CC=7 SCAR=40.3
178  
179 0 my $class = shift;
180 0 my $config = shift;
181  
182 0 ▶ if ( defined $config && ref $config ne 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $config and ref $config ne "HASH") 0 0 0
Condition0%0/3
defined $config and ref $config ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $config and ref $config ne "HASH"
defined $config ref $config ne "HASH"
Truth table0%0/3
A and B
A= defined $configB= ref $config ne "HASH"
ABresult
0X0
100
111
183 0 complain "Invalid argument";
184 }
185  
186 0 ▶ if ( $class->_is_setup ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->_is_setup) 0 0 0
187  
188 0 ▶ if ( defined $config ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $config) 0 0 0
189 0 complain "$class has already been setup";
190 }
191  
192 0 return;
193  
194 }
195  
196 0 eval {
197 0 ▶ $class->_component_interface->_setup( $config // {} );
Condition0%0/2
$config // {}
l!l
00
MC/DC0%0/1
$config // {}
$config
Truth table0%0/2
A
A= $config
Aresult
11
00
198 };
199  
200 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
201 0 GX::Exception->complain(
202 message => "$class setup failed",
203 subexception => $@
204 );
205 }
206  
207 0 $class->_is_setup( 1 );
208  
209 0 return;
210  
211 }
212  
213 0 ▶sub __start {
Subroutine __start: not called CC=4 SCAR=30.0
214  
215 0 my $class = shift;
216  
217 0 ▶ if ( $class->_is_running ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->_is_running) 0 0 0
218 0 return;
219 }
220  
221 0 ▶ if ( ! $class->_is_deployed ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->_is_deployed) 0 0 0
222 0 complain "Cannot start $class (component has not been deployed)";
223 }
224  
225 0 eval {
226 0 $class->_component_interface->_start;
227 };
228  
229 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
230 0 GX::Exception->complain(
231 message => "Cannot start $class",
232 subexception => $@
233 );
234 }
235  
236 0 $class->_is_running( 1 );
237  
238 0 return;
239  
240 }
241  
242 0 ▶sub __unload {
Subroutine __unload: not called CC=3 SCAR=24.8
243  
244 0 my $class = shift;
245  
246 0 ▶ if ( $class->application ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class->application) 0 0 0
247 0 complain "Cannot unload $class (component is still registered)";
248 }
249  
250 0 eval {
251 0 $class->_component_interface->_unload;
252 };
253  
254 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
255 0 GX::Exception->complain(
256 message => "Cannot unload $class",
257 subexception => $@
258 );
259 }
260  
261 0 return;
262  
263 }
264  
265 0 ▶sub __unregister {
Subroutine __unregister: not called CC=3 SCAR=24.8
266  
267 0 my $class = shift;
268  
269 0 ▶ if ( ! $class->application ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($class->application) 0 0 0
270 0 return;
271 }
272  
273 0 eval {
274 0 $class->_component_interface->_unregister;
275 };
276  
277 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
278 0 GX::Exception->complain(
279 message => "Cannot unregister $class",
280 subexception => $@
281 );
282 }
283  
284 0 return;
285  
286 }
287  
288  
289 # ----------------------------------------------------------------------------------------------------------------------
290 # Private methods
291 # ----------------------------------------------------------------------------------------------------------------------
292  
293 1 ▶sub _add_handler {
Subroutine _add_handler: called CC=5 SCAR=19.4
294  
295 1 my $invocant = shift;
296 1 my $hook_name = shift;
297 1 my $handler = shift;
298  
299 1 ▶ if ( ! defined $hook_name || ! defined $handler ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $hook_name and defined $handler) 0 1 1
Condition33%1/3
defined $hook_name and defined $handler
!ll&&!rl&&r
001
MC/DC0%0/2
defined $hook_name and defined $handler
defined $hook_name defined $handler
Truth table33%1/3
A and B
A= defined $hook_nameB= defined $handler
ABresult
0X0
100
111
300 0 complain "Missing argument";
301 }
302  
303 1 ▶ if ( blessed $handler ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($handler)) { } 0 1 1
304  
305 0 ▶ if ( ! $handler->isa( 'GX::Callback::Method' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($handler->isa("GX::Callback::Method")) 0 0 0
306 0 complain "Invalid argument";
307 }
308  
309 }
310 else {
311 1 $handler = $invocant->_create_handler( $handler );
312 }
313  
314 1 push @{$invocant->_get_handlers->{$hook_name}}, $handler;
315  
316 1 return;
317  
318 }
319  
320 0 ▶sub _component_interface {
Subroutine _component_interface: not called CC=2 SCAR=17.9
321  
322 0 ▶ return ref $_[0] || $_[0];
Condition0%0/3
ref $_[0] || $_[0]
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0] $_[0]
Truth table0%0/3
A || B
A= ref $_[0]B= $_[0]
ABresult
1X1
011
000
323  
324 }
325  
326 1 ▶sub _create_handler {
Subroutine _create_handler: called CC=1 SCAR=0.0
327  
328 1 my $invocant = shift;
329 1 my $method = shift;
330  
331 1 return GX::Callback::Method->new( invocant => $invocant->_component_interface, method => $method );
332  
333 }
334  
335 0 ▶sub _deploy {
Subroutine _deploy: not called CC=1 SCAR=0.0
336  
337 # Abstract method
338  
339 }
340  
341 0 ▶sub _export_attribute {
Subroutine _export_attribute: not called CC=7 SCAR=40.3
342  
343 0 my $invocant = shift;
344 0 my $importer = shift;
345 0 my $attribute = shift;
346  
347 0 ▶ if ( ! defined $importer || ! defined $attribute ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $importer and defined $attribute) 0 0 0
Condition0%0/3
defined $importer and defined $attribute
!ll&&!rl&&r
000
MC/DC0%0/2
defined $importer and defined $attribute
defined $importer defined $attribute
Truth table0%0/3
A and B
A= defined $importerB= defined $attribute
ABresult
0X0
100
111
348 0 complain "Missing or invalid argument";
349 }
350  
351 0 ▶ if ( ! eval { $importer->isa( 'GX::Class' ) } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $importer->isa("GX::Class") } }) 0 0 0
352 0 complain "Cannot export attribute ($importer is not a GX::Class)";
353 }
354  
355 0 eval {
356  
357 0 ▶ if ( ref $attribute eq 'HASH' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attribute eq 'HASH') { } 0 0 0
358 0 $attribute = $importer->meta->add_attribute( %$attribute );
359 }
360 else {
361 0 $attribute = $importer->meta->add_attribute( $attribute );
362 }
363  
364 0 $attribute->install;
365  
366 0 ▶ if ( $importer->can( '__build' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($importer->can("__build")) 0 0 0
367 0 $importer->__build;
368 }
369  
370 };
371  
372 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
373 0 GX::Exception->complain(
374 message => "Cannot export attribute",
375 subexception => $@
376 );
377 }
378  
379 0 return;
380  
381 }
382  
383 0 ▶sub _export_method {
Subroutine _export_method: not called CC=6 SCAR=37.4
384  
385 0 my $invocant = shift;
386 0 my $importer = shift;
387 0 my $method = shift;
388 0 my $code = shift;
389  
390 0 ▶ if ( ! defined $importer || ! defined $method || ! defined $code ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $importer and defined $method and defined $code) 0 0 0
Condition0%0/6
defined $importer and defined $method and defined $code
!ll&&!rl&&r
000
defined $importer and defined $method
!ll&&!rl&&r
000
MC/DC0%0/3
defined $importer and defined $method and defined $code
defined $importer defined $method defined $code
Truth table0%0/4
A and B and C
A= defined $importerB= defined $methodC= defined $code
ABCresult
0XX0
10X0
1100
1111
391 0 complain "Missing or invalid argument";
392 }
393  
394 0 ▶ if ( ! eval { $importer->isa( 'GX::Class' ) } ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (eval { do { $importer->isa("GX::Class") } }) 0 0 0
395 0 complain "Cannot export method ($importer is not a GX::Class)";
396 }
397  
398 0 eval {
399 0 $importer->meta->add_method( $method, $code );
400 };
401  
402 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
403 0 GX::Exception->complain(
404 message => "Cannot export method",
405 subexception => $@
406 );
407 }
408  
409 0 return;
410  
411 }
412  
413 4 ▶sub _initialize_config {
Subroutine _initialize_config: called CC=1 SCAR=0.0
414  
415 4 return {};
416  
417 }
418  
419 67 ▶sub _install_import_method {
Subroutine _install_import_method: called CC=2 SCAR=7.0
420  
421 67 my $class = shift;
422  
423 67 ▶ return if $class eq __PACKAGE__;
Branch: 1 branch
BranchTrueFalseTotal
if $class eq __PACKAGE__ 0 67 67
424  
425 $class->meta->add_method(
426  
427 43 ▶ 'import' => sub {
Subroutine __ANON__: called CC=5 SCAR=16.4
428  
429 43 my $package = shift;
430 43 my $caller = caller;
431  
432 43 ▶ return if $package ne $class || $caller eq 'main';
Branch: 1 branch
BranchTrueFalseTotal
if $package ne $class or $caller eq "main" 3 40 43
Condition66%2/3
$package ne $class or $caller eq "main"
l!l&&r!l&&!r
0340
MC/DC50%1/2
$package ne $class or $caller eq "main"
$package ne $class $caller eq "main"
Truth table66%2/3
A or B
A= $package ne $classB= $caller eq "main"
ABresult
1X1
011
000
433  
434 40 ▶ if ( ! $package->_validate_class_name( $caller ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($package->_validate_class_name($caller)) 0 40 40
435 0 complain "Cannot import $package (\"$caller\" is not a valid class name for a $package component)";
436 }
437  
438 40 for my $pragma ( qw( strict warnings ) ) {
439 80 $pragma->import;
440 }
441  
442 40 my $meta = GX::Meta::Class->new( $caller );
443 40 $meta->inherit_from( $package );
444  
445 40 return;
446  
447 }
448  
449 67 );
450  
451 67 return;
452  
453 }
454  
455 0 ▶sub _is_deployed {
Subroutine _is_deployed: not called CC=2 SCAR=17.9
456  
457 0 my $invocant = shift;
458  
459 0 ▶ if ( $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 0 0 0
460 0 $invocant->_set_component_state( STATE_DEPLOYED );
461 0 return;
462 }
463  
464 0 return $invocant->_get_component_state >= STATE_DEPLOYED;
465  
466 }
467  
468 0 ▶sub _is_initialized {
Subroutine _is_initialized: not called CC=2 SCAR=17.9
469  
470 0 my $invocant = shift;
471  
472 0 ▶ if ( $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 0 0 0
473 0 $invocant->_set_component_state( STATE_INITIALIZED );
474 0 return;
475 }
476  
477 0 return $invocant->_get_component_state >= STATE_INITIALIZED;
478  
479 }
480  
481 0 ▶sub _is_reloading {
Subroutine _is_reloading: not called CC=2 SCAR=17.9
482  
483 0 my $invocant = shift;
484  
485 0 ▶ if ( $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 0 0 0
486 0 $invocant->_set_component_state( STATE_RELOADING );
487 0 return;
488 }
489  
490 0 return $invocant->_get_component_state == STATE_RELOADING;
491  
492 }
493  
494 0 ▶sub _is_running {
Subroutine _is_running: not called CC=2 SCAR=17.9
495  
496 0 my $invocant = shift;
497  
498 0 ▶ if ( $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 0 0 0
499 0 $invocant->_set_component_state( STATE_RUNNING );
500 0 return;
501 }
502  
503 0 return $invocant->_get_component_state >= STATE_RUNNING;
504  
505 }
506  
507 14 ▶sub _is_setup {
Subroutine _is_setup: called CC=2 SCAR=6.9
508  
509 14 my $invocant = shift;
510  
511 14 ▶ if ( $_[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]) 7 7 14
512 7 $invocant->_set_component_state( STATE_SETUP );
513 7 return;
514 }
515  
516 7 return $invocant->_get_component_state >= STATE_SETUP;
517  
518 }
519  
520 0 ▶sub _register {
Subroutine _register: not called CC=1 SCAR=6.9
521  
522 0 my $invocant = shift;
523 0 my $application = shift;
524  
525 0 $invocant->_set_application( $application );
526  
527 0 $invocant->_register_handlers;
528  
529 0 return;
530  
531 }
532  
533 0 ▶sub _register_handlers {
Subroutine _register_handlers: not called CC=4 SCAR=30.0
534  
535 0 my $invocant = shift;
536  
537 0 my $handlers = $invocant->_get_handlers;
538  
539 0 ▶ while ( my ( $hook_name, $handlers ) = each %$handlers ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$handlers) 0 0 0
540  
541 0 ▶ if ( my $hook = $invocant->application->hook( $hook_name ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $hook = $invocant->application->hook($hook_name)) 0 0 0
542  
543 0 for my $handler ( @$handlers ) {
544 0 $hook->add( $handler );
545 }
546  
547 }
548  
549 }
550  
551 0 return;
552  
553 }
554  
555 7 ▶sub _setup {
Subroutine _setup: called CC=1 SCAR=0.0
556  
557 7 my $invocant = shift;
558 7 my $config = shift;
559  
560 7 $invocant->_setup_config( $config );
561  
562 7 $invocant->_setup_handlers;
563  
564 7 return;
565  
566 }
567  
568 6 ▶sub _setup_config {
Subroutine _setup_config: called CC=3 SCAR=12.3
569  
570 6 my $invocant = shift;
571 6 my $config = shift;
572  
573 6 $invocant->_get_config; # initialize
574  
575 6 ▶ if ( $config && %$config ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($config and %$config) 0 6 6
Condition33%1/3
$config and %$config
!ll&&!rl&&r
060
MC/DC0%0/2
$config and %$config
$config %$config
Truth table33%1/3
A and B
A= $configB= %$config
ABresult
0X0
100
111
576 0 throw sprintf( "Unrecognized setup option (\"%s\")", ( sort keys %$config )[0] );
577 }
578  
579 6 return;
580  
581 }
582  
583 7 ▶sub _setup_handlers {
Subroutine _setup_handlers: called CC=4 SCAR=13.9
584  
585 7 my $invocant = shift;
586  
587 7 $invocant->_get_handlers; # initialize
588  
589 7 for my $method ( $invocant->meta->all_methods ) {
590  
591 607 for my $attribute ( $method->code_attributes ) {
592  
593 1 ▶ if ( $attribute =~ /^Handler\(\s?(\w+?)\s?\)$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attribute =~ /^Handler\(\s?(\w+?)\s?\)$/) 1 0 1
594 1 $invocant->_add_handler( $1, $method->name );
595 }
596  
597 }
598  
599 }
600  
601 7 return;
602  
603 }
604  
605 0 ▶sub _start {
Subroutine _start: not called CC=1 SCAR=0.0
606  
607 # Abstract method
608  
609 }
610  
611 0 ▶sub _unload {
Subroutine _unload: not called CC=1 SCAR=0.0
612  
613 # Abstract method
614  
615 }
616  
617 0 ▶sub _unregister {
Subroutine _unregister: not called CC=1 SCAR=6.9
618  
619 0 my $invocant = shift;
620  
621 0 $invocant->_unregister_handlers;
622  
623 0 $invocant->_set_application( undef );
624  
625 0 return;
626  
627 }
628  
629 0 ▶sub _unregister_handlers {
Subroutine _unregister_handlers: not called CC=4 SCAR=30.0
630  
631 0 my $invocant = shift;
632  
633 0 my $handlers = $invocant->_get_handlers;
634  
635 0 ▶ while ( my ( $hook_name, $handlers ) = each %$handlers ) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$handlers) 0 0 0
636  
637 0 ▶ if ( my $hook = $invocant->application->hook( $hook_name ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $hook = $invocant->application->hook($hook_name)) 0 0 0
638  
639 0 for my $handler ( @$handlers ) {
640 0 $hook->remove( $handler );
641 }
642  
643 }
644  
645 }
646  
647 0 return;
648  
649 }
650  
651 0 ▶sub _validate_class_name {
Subroutine _validate_class_name: not called CC=1 SCAR=0.0
652  
653 # Abstract method
654  
655 }
656  
657  
658 50 1;
659  
660 __END__
« GX/Meta/Util.pm ↑ Summary GX/HTTP/Response/Cookie.pm »