OpenInteract2/Setup/DependencySource.pm

filter: Statementstmt 93.1% 41 / 44 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 84.1% 53 / 63 CC 6 SCAR 13.0
CC
6
Cov
85%
_load_item_list
6.8
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« OpenInteract2/Config/Readonly.pm ↑ Summary OpenInteract2/Conversion/ActionConfig.pm »
1 package OpenInteract2::Setup::DependencySource;
2  
3 # $Id: DependencySource.pm,v 1.2 2005/03/18 04:09:51 lachoy Exp $
4  
5 87 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 87 ▶use base qw( Algorithm::Dependency::Source );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 87 ▶use Algorithm::Dependency::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 87 ▶use Log::Log4perl qw( get_logger );
Subroutine BEGIN: called CC=1 SCAR=0.0
9 87 ▶use OpenInteract2::Constants qw( LOG_INIT );
Subroutine BEGIN: called CC=1 SCAR=0.0
10 87 ▶use OpenInteract2::Exception qw( oi_error );
Subroutine BEGIN: called CC=1 SCAR=0.0
11 87 ▶use OpenInteract2::Setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 87 $OpenInteract2::Setup::DependencySource::VERSION = sprintf("%d.%02d", q$Revision: 1.2 $ =~ /(\d+)\.(\d+)/);
14  
15 87 my ( $log );
16  
17 1 ▶sub _load_item_list {
Subroutine _load_item_list: called CC=6 SCAR=19.1
18 1 my ( $self ) = @_;
19 1 ▶ $log ||= get_logger( LOG_INIT );
Condition33%1/3
$log ||= get_logger("OI2.INITIALIZE")
l!l&&r!l&&!r
010
MC/DC0%0/2
$log ||= get_logger("OI2.INITIALIZE")
$log get_logger("OI2.INITIALIZE")
Truth table33%1/3
A ||= B
A= $logB= get_logger("OI2.INITIALIZE")
ABresult
1X1
011
000
20 1 my @all_actions = OpenInteract2::Setup->list_actions;
21 1 $log->info( "Setup lists '", scalar( @all_actions ), "' actions available" );
22 1 my @ad_items = ();
23 1 foreach my $action ( @all_actions ) {
24 20 ▶ next unless ( $action ); # just in case...
Branch: 1 branch
BranchTrueFalseTotal
unless $action 0 20 20
25 20 my $item = eval { OpenInteract2::Setup->new( $action ) };
26 20 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 20 20
27 0 $log->warn( "Cannot instantiate setup task '$action' ($@); ",
28 "this won't be used to determine dependencies" );
29 0 next;
30 }
31 20 my @dep_names = $item->get_dependencies;
32 20 my $dep_name_listing = join( ', ', @dep_names );
33 20 my $dep_item = Algorithm::Dependency::Item->new( $action, @dep_names );
34 20 ▶ unless ( $dep_item ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($dep_item) 0 20 20
35 0 oi_error "Failed to create dep item from '$action' and ",
36 "'$dep_name_listing' (no error given)";
37 }
38 20 $log->debug( "Adding setup '$action' with dependencies ",
39 "'$dep_name_listing'" );
40 20 push @ad_items, $dep_item;
41 }
42 1 return \@ad_items;
43 }
44  
45 87 1;
46  
47 __END__
« OpenInteract2/Config/Readonly.pm ↑ Summary OpenInteract2/Conversion/ActionConfig.pm »