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             package HackaMol::Roles::ExeRole;
2             $HackaMol::Roles::ExeRole::VERSION = '0.051';
3             #ABSTRACT:
4 11     11   7207 use 5.008;
  11         51  
5 11     11   85 use Moose::Role;
  11         31  
  11         99  
6 11     11   62653 use Carp;
  11         33  
  11         2316  
7              
8             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             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             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     2 1 769 my $self = shift;
36 2 100       73 if (-e $self->exe){
37 1         10 return 1;
38             }
39             else {
40 1         31 carp $self->exe . " does not exist";
41 1         636 return 0;
42             }
43             }
44              
45 11     11   122 no Moose::Role;
  11         49  
  11         69  
46              
47             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