blib/lib/HackaMol/X/Calculator.pm

filter: Statementstmt 100% 43 / 43 Branchbran 100% 16 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 2 totaltotal 97.2% 71 / 73 CC 9 SCAR 11.0
CC
9
Cov
100%
build_command
5.0
BUILD
5.0
BEGIN
1.0
CRAP 3.0
↑ Summary
1 package HackaMol::X::Calculator;
2 2 $HackaMol::X::Calculator::VERSION = '0.012';
3 # ABSTRACT: Abstract calculator class for HackaMol
4 2 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use MooseX::StrictConstructor;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 with qw(HackaMol::X::Roles::ExtensionRole);
12  
13 1 ▶sub _build_map_in{
Subroutine _build_map_in: called CC=1 SCAR=0.0
14 1 ▶ my $sub_cr = sub { return (@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
15 1 return $sub_cr;
16 }
17  
18 1 ▶sub _build_map_out{
Subroutine _build_map_out: called CC=1 SCAR=0.0
19 1 ▶ my $sub_cr = sub { return (@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
20 1 return $sub_cr;
21 }
22  
23 5 ▶sub build_command {
Subroutine build_command: called CC=5 SCAR=16.1
Pod undocumented
24 # exe -options file.inp -moreoptions > file.out
25 5 my $self = shift;
26 5 ▶ return 0 unless $self->exe;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->exe 1 4 5
27 4 my $cmd;
28 4 $cmd = $self->exe;
29 4 ▶ $cmd .= " " . $self->in_fn->stringify if $self->has_in_fn;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_in_fn 3 1 4
30 4 ▶ $cmd .= " " . $self->exe_endops if $self->has_exe_endops;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_exe_endops 2 2 4
31 4 ▶ $cmd .= " > " . $self->out_fn->stringify if $self->has_out_fn;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_out_fn 1 3 4
32  
33 # no cat of out_fn because of options to run without writing, etc
34 4 return $cmd;
35 }
36  
37 12 ▶sub BUILD {
Subroutine BUILD: called CC=5 SCAR=16.1
Pod undocumented
38 12 my $self = shift;
39  
40 12 ▶ if ( $self->has_scratch ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_scratch) 7 5 12
41 7 ▶ $self->scratch->mkpath unless ( $self->scratch->exists );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->scratch->exists 3 4 7
42 }
43  
44 12 ▶ unless ( $self->has_command ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->has_command) 9 3 12
45 9 ▶ return unless ( $self->has_exe );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_exe 7 2 9
46 2 my $cmd = $self->build_command;
47 2 $self->command($cmd);
48 }
49 5 return;
50 }
51  
52 2 __PACKAGE__->meta->make_immutable;
53  
54 2 1;
55  
56 __END__
↑ Summary