blib/lib/LSF/Hosts.pm

filter: Statementstmt 53.8% 21 / 39 Branchbran 7.1% 1 / 14 Conditioncond 25.0% 3 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 41.0% 32 / 78 CC 15 SCAR 36.7
CC
15
Cov
38%
new
75.7
import
14.1
BEGIN
1.0
CRAP 39.2
↑ Summary
1 package LSF::Hosts;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base qw( LSF );
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use IPC::Run qw( run );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 our $VERSION = '0.01';
8  
9 sub import
10 1 ▶{
Subroutine import: called CC=7 SCAR=26.5
11 1 my ( $self, %p ) = @_;
12 1 ▶ $p{RaiseError} ||= 1;
Condition50%1/2
$p{"RaiseError"} ||= 1
l!l
01
MC/DC0%0/1
$p{"RaiseError"} ||= 1
$p{"RaiseError"}
Truth table50%1/2
A
A= $p{"RaiseError"}
Aresult
11
00
13 1 ▶ $p{PrintOutput} ||= 1;
Condition50%1/2
$p{"PrintOutput"} ||= 1
l!l
01
MC/DC0%0/1
$p{"PrintOutput"} ||= 1
$p{"PrintOutput"}
Truth table50%1/2
A
A= $p{"PrintOutput"}
Aresult
11
00
14 1 ▶ $p{PrintError} ||= 1;
Condition50%1/2
$p{"PrintError"} ||= 1
l!l
01
MC/DC0%0/1
$p{"PrintError"} ||= 1
$p{"PrintError"}
Truth table50%1/2
A
A= $p{"PrintError"}
Aresult
11
00
15 1 ▶ $self->PrintOutput( $p{PrintOutput} ) if exists $p{PrintOutput};
Branch: 1 branch
BranchTrueFalseTotal
if exists $p{"PrintOutput"} 1 0 1
16 0 ▶ $self->PrintError( $p{PrintError} ) if exists $p{PrintError};
Branch: 1 branch
BranchTrueFalseTotal
if exists $p{"PrintError"} 0 0 0
17 0 ▶ $self->RaiseError( $p{RaiseError} ) if exists $p{RaiseError};
Branch: 1 branch
BranchTrueFalseTotal
if exists $p{"RaiseError"} 0 0 0
18 }
19  
20 sub new
21 1 ▶{
Subroutine new: called CC=9 SCAR=43.3
Pod documented
22 1 my ( $class, @params ) = @_;
23 1 my @output = $class->do_it( 'bhosts', '-l' );
24 0 ▶ return unless @output;
Branch: 1 branch
BranchTrueFalseTotal
unless @output 0 0 0
25 0 my @hosts;
26 my $host;
27 0 my @keys = qw(STATUS CPUF JL/U MAX NJOBS RUN SSUSP USUSP RSV DISPATCH_WINDOW);
28 0 foreach ( split( /\n/, $output[0] ) ) {
29 0 ▶ if ( /HOST/ .. /^\s*$/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (/HOST/ .. /^\s*$/) 0 0 0
30 0 my $hostline = $_;
31 0 ▶ if (/HOST\s+(\S+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if (/HOST\s+(\S+)/) 0 0 0
32 0 $host = {};
33 0 $host->{HOST_NAME} = $1;
34 }
35 0 ▶ if ( !( /HOST/ || /STATUS/ || /^\s*$/ ) ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (/HOST/ or /STATUS/ or /^\s*$/) 0 0 0
Condition0%0/6
/HOST/ or /STATUS/ or /^\s*$/
l!l&&r!l&&!r
000
/HOST/ or /STATUS/
l!l&&r!l&&!r
000
MC/DC0%0/3
/HOST/ or /STATUS/ or /^\s*$/
/HOST/ /STATUS/ /^\s*$/
Truth table0%0/4
A or B or C
A= /HOST/B= /STATUS/C= /^\s*$/
ABCresult
1XX1
01X1
0011
0000
36 0 my @values = split /\s+/, $hostline;
37 0 for ( 0 .. @keys - 1 ) { $host->{ $keys[$_] } = $values[$_]; }
38 0 bless $host, $class;
39 0 push @hosts, $host;
40 }
41 }
42 }
43 0 return @hosts;
44 }
45  
46 1 1;
47  
48 __END__
↑ Summary