HackaMol/Roles/ExeRole.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 29 / 29 SCAR 6.9
CC
2
Cov
100%
exists_exe
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« HackaMol/AtomGroup.pm ↑ Summary HackaMol/Roles/QmMolRole.pm »
1 package HackaMol::Roles::ExeRole;
2 11 $HackaMol::Roles::ExeRole::VERSION = '0.051';
3 #ABSTRACT:
4 11 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 has 'exe' => (
9 is => 'rw',
10 isa => 'Str',
11 predicate => 'has_exe',
12 clearer => 'clear_exe',
13 );
14  
15  
16 #options after input filename... bleh
17 # ie. dftd3 shit.xyz -func b3pw91 -bj
18 11 has 'exe_endops' => (
19 is => 'rw',
20 isa => 'Str',
21 predicate => 'has_exe_endops',
22 clearer => 'clear_exe_endops',
23 );
24  
25 # this will be called by capture::tiny
26 11 has 'command' => (
27 is => 'rw',
28 isa => 'Str',
29 predicate => 'has_command',
30 clearer => 'clear_command',
31 );
32  
33  
34 sub exists_exe {
35 2 ▶ my $self = shift;
Subroutine exists_exe: called CC=2 SCAR=6.9
Pod documented
36 2 ▶ if (-e $self->exe){
Branch: 1 branch
BranchTrueFalseTotal
if (-e $self->exe) { } 1 1 2
37 1 return 1;
38 }
39 else {
40 1 carp $self->exe . " does not exist";
41 1 return 0;
42 }
43 }
44  
45 11 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 11 1;
48  
49 __END__
50  
51 =pod
52  
53 =head1 NAME
54  
55 HackaMol::Roles::ExeRole -
56  
57 =head1 VERSION
58  
59 version 0.051
60  
61 =head1 DESCRIPTION
62  
63 This role adds executables/commands for running external programs. This is still a work in progress, and it will
64 probably change (suggestions and help very much welcome!). The goal is to reduce the amount code required for
65 building interfaces to external programs to be run on inputs to generate output in some directory that may be
66 temporary... or not. Of course, exes do all sorts of things where other files may be written. Requirements (e.g. a
67 method that tests functionality) for interfaces are still under development. Considering the trickiness of this
68 sort of abstraction, it will cowardly left to the extensions to figure out. Recommendation: Capture::Tiny
69  
70 =head1 METHODS
71  
72 =head2 exists_exe
73  
74 return 1 if exe exists, carp warning and return 0 if exe does not exist
75  
76 =head1 ATTRIBUTES
77  
78 =head2 command
79  
80 isa Str that is rw
81  
82 to be constructed from exe, exe_endops, in_fn, out_fn, etc. Then run and
83 captured, which is left to scripts/interfaces
84  
85 =head2 exe
86  
87 isa Str that is rw
88  
89 the program to be run. $self->command($self->exe . " < " . $self->in_fn . " > " . $self->out_fn);
90  
91 =head2 exe_endops
92  
93 isa Str that is rw
94  
95 options to be catenated to the end of the exe. For those command line tools that use options after input filename
96  
97 =head1 AUTHOR
98  
99 Demian Riccardi <demianriccardi@gmail.com>
100  
101 =head1 COPYRIGHT AND LICENSE
102  
103 This software is copyright (c) 2017 by Demian Riccardi.
104  
105 This is free software; you can redistribute it and/or modify it under
106 the same terms as the Perl 5 programming language system itself.
107  
108 =cut
« HackaMol/AtomGroup.pm ↑ Summary HackaMol/Roles/QmMolRole.pm »