File Coverage

blib/lib/HackaMol/Roles/ExeRole.pm
Criterion Covered Total %
statement 16 16 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 24 24 100.0


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