OpenInteract2/ActionResolver/NameAndTask.pm

filter: Statementstmt 54.0% 20 / 37 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 6 / 8 Podpod 0.0% 0 / 3 totaltotal 40.0% 26 / 65 CC 8 SCAR 36.6
CC
8
Cov
38%
resolve
72.0
get_order
2.0
BEGIN
1.0
CRAP 38.9
« OpenInteract2/Setup/RequireClasses.pm ↑ Summary OpenInteract2/Action/CommonDisplay.pm »
1 package OpenInteract2::ActionResolver::NameAndTask;
2  
3 # $Id: NameAndTask.pm,v 1.2 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::NameAndTask::VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
12  
13 87 my ( $log );
14  
15 87 ▶sub get_name { return 'name_from_url' }
Subroutine get_name: called CC=1 SCAR=0.0
Pod undocumented
16  
17 0 ▶sub get_order { return 9 }
Subroutine get_order: not called CC=1 SCAR=6.9
Pod undocumented
18  
19 0 ▶sub resolve {
Subroutine resolve: not called CC=8 SCAR=42.8
Pod undocumented
20 0 my ( $self, $request, $url ) = @_;
21  
22 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
23  
24 0 my ( $action_name, $task_name, @params ) = OpenInteract2::URL->parse( $url );
25 0 ▶ return undef unless ( $action_name );
Branch: 1 branch
BranchTrueFalseTotal
unless $action_name 0 0 0
26  
27 0 ▶ $log->is_info &&
Branch: 1 branch
BranchTrueFalseTotal
$log->is_info and $log->info("Lookup action '${action_name}' from context") 0 0 0
28 $log->info( "Lookup action '$action_name' from context" );
29 0 my $action = eval {
30 0 CTX->lookup_action( $action_name, { REQUEST_URL => $url } )
31 };
32 0 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
33 0 $log->warn( "Caught exception from context trying to lookup ",
34 "action '$action_name': $@" );
35 0 return undef;
36 }
37 $log->is_info &&
38 0 ▶ $log->info( "Found action '", ref( $action ), "'" );
Branch: 1 branch
BranchTrueFalseTotal
$log->is_info and $log->info("Found action '", ref $action, "'") 0 0 0
39 0 ▶ if ( $task_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($task_name) 0 0 0
40 0 $action->task( $task_name );
41 0 ▶ $log->is_info &&
Branch: 1 branch
BranchTrueFalseTotal
$log->is_info and $log->info("Assigned task '${task_name}' to action") 0 0 0
42 $log->info( "Assigned task '$task_name' to action" );
43 }
44 0 $self->assign_additional_params_from_url( $request, @params );
45 0 return $action
46 }
47  
48 87 OpenInteract2::ActionResolver->register_factory_type( get_name() => __PACKAGE__ );
49  
50 87 1;
51  
52 __END__
« OpenInteract2/Setup/RequireClasses.pm ↑ Summary OpenInteract2/Action/CommonDisplay.pm »