OpenInteract2/ActionResolver/NotFoundOrEmpty.pm

filter: Statementstmt 60.0% 21 / 35 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 66.6% 6 / 9 Podpod 0.0% 0 / 3 totaltotal 41.5% 27 / 65 CC 7 SCAR 25.6
CC
7
Cov
43%
resolve
30.0
_init_default_actions
12.0
get_order
2.0
CRAP 12.9
« OpenInteract2/Manage/Website/UpdatePackageFromWebsite.pm ↑ Summary OpenInteract2/ContentGenerator/HtmlTemplate.pm »
1 package OpenInteract2::ActionResolver::NotFoundOrEmpty;
2  
3 # $Id: NotFoundOrEmpty.pm,v 1.3 2005/03/02 15:31:34 lachoy Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( OpenInteract2::ActionResolver );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use Log::Log4perl qw( get_logger );
Subroutine BEGIN: called CC=1 SCAR=0.0
8 87 ▶use OpenInteract2::Constants qw( LOG_ACTION );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 87 ▶use OpenInteract2::Context qw( CTX );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 87 $OpenInteract2::ActionResolver::NotFoundOrEmpty::VERSION = sprintf("%d.%02d", q$Revision: 1.3 $ =~ /(\d+)\.(\d+)/);
12  
13 87 my ( $log );
14  
15 87 my ( $NONE_ACTION, $NOTFOUND_ACTION );
16  
17 87 ▶sub get_name { return 'notfound' }
Subroutine get_name: called CC=1 SCAR=0.0
Pod undocumented
18  
19 # This goes to 11!
20 0 ▶sub get_order { return 11 }
Subroutine get_order: not called CC=1 SCAR=6.9
Pod undocumented
21  
22 0 ▶sub resolve {
Subroutine resolve: not called CC=5 SCAR=34.0
Pod undocumented
23 0 my ( $self, $request, $url ) = @_;
24 0 $self->_init_default_actions;
25 0 ▶ $log ||= get_logger( LOG_ACTION );
Condition0%0/3
$log ||= get_logger("OI2.ACTION")
l!l&&r!l&&!r
000
MC/DC0%0/2
$log ||= get_logger("OI2.ACTION")
$log get_logger("OI2.ACTION")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.ACTION")
ABresult
1X1
011
000
26 0 my ( $action_name ) = OpenInteract2::URL->parse( $url );
27 0 ▶ if ( $action_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($action_name) { } 0 0 0
28 0 ▶ $log->is_debug &&
Branch: 1 branch
BranchTrueFalseTotal
$log->is_debug and $log->debug("Action name '${action_name}' found, so ", "using 'not_found' action '", $NOTFOUND_ACTION->name, "'") 0 0 0
29 $log->debug( "Action name '$action_name' found, so ",
30 "using 'not_found' action '", $NOTFOUND_ACTION->name, "'" );
31 0 return $NOTFOUND_ACTION->clone();
32 }
33 else {
34 0 ▶ $log->is_debug &&
Branch: 1 branch
BranchTrueFalseTotal
$log->is_debug and $log->debug("Using action specified for 'none': ", "'", $NONE_ACTION->name, "'") 0 0 0
35 $log->debug( "Using action specified for 'none': ",
36 "'", $NONE_ACTION->name, "'" );
37 0 return $NONE_ACTION->clone();
38 }
39 }
40  
41 0 ▶sub _init_default_actions {
Subroutine _init_default_actions: not called CC=3 SCAR=24.8
42 0 my ( $class ) = @_;
43 0 ▶ return if ( $NONE_ACTION and $NOTFOUND_ACTION );
Branch: 1 branch
BranchTrueFalseTotal
if $NONE_ACTION and $NOTFOUND_ACTION 0 0 0
Condition0%0/3
$NONE_ACTION and $NOTFOUND_ACTION
!ll&&!rl&&r
000
MC/DC0%0/2
$NONE_ACTION and $NOTFOUND_ACTION
$NONE_ACTION $NOTFOUND_ACTION
Truth table0%0/3
A and B
A= $NONE_ACTIONB= $NOTFOUND_ACTION
ABresult
0X0
100
111
44 0 $NONE_ACTION = CTX->lookup_action_none;
45 0 $NOTFOUND_ACTION = CTX->lookup_action_not_found;
46 }
47  
48 87 OpenInteract2::ActionResolver->register_factory_type( get_name() => __PACKAGE__ );
49  
50 87 1;
51  
52 __END__
« OpenInteract2/Manage/Website/UpdatePackageFromWebsite.pm ↑ Summary OpenInteract2/ContentGenerator/HtmlTemplate.pm »