| 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
| |||||||||||
| 27 | 4 | my $cmd; | |||||||||
| 28 | 4 | $cmd = $self->exe; | |||||||||
| 29 | 4 | ▶ | $cmd .= " " . $self->in_fn->stringify if $self->has_in_fn; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 4 | ▶ | $cmd .= " " . $self->exe_endops if $self->has_exe_endops; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 4 | ▶ | $cmd .= " > " . $self->out_fn->stringify if $self->has_out_fn; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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
| |||||||||||
| 41 | 7 | ▶ | $self->scratch->mkpath unless ( $self->scratch->exists ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 12 | ▶ | unless ( $self->has_command ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | 9 | ▶ | return unless ( $self->has_exe ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||