blib/lib/BioX/Workflow/Plugin/FileExists.pm

filter: Statementstmt 47.2% 17 / 36 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod n/a totaltotal 42.3% 22 / 52 CC 6 SCAR 31.5
CC
6
Cov
37%
__ANON__
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 23.4
↑ Summary Build »
1 package BioX::Workflow::Plugin::FileExists;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use 5.008_005;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 our $VERSION = '0.12';
7  
8 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Data::Pairs;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 before 'write_process' => sub{
14 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=6 SCAR=37.4
15  
16 0 print "# In before write process!\n";
17 0 my $process = $self->process;
18 0 chomp($process);
19  
20 0 ▶ my @input = $self->local_attr->get_values('INPUT') if $self->local_attr->exists('INPUT');
Branch: 1 branch
BranchTrueFalseTotal
if $self->local_attr->exists("INPUT") 0 0 0
21 0 ▶ my @output = $self->local_attr->get_values('OUTPUT') if $self->local_attr->exists('OUTPUT');
Branch: 1 branch
BranchTrueFalseTotal
if $self->local_attr->exists("OUTPUT") 0 0 0
22  
23 0 my($input, $output) = ($input[0], $output[0]);
24  
25 0 my $tprocess = "";
26 0 ▶ if($input){
Branch: 1 branch
BranchTrueFalseTotal
if ($input) 0 0 0
27 0 $tprocess .=<<EOF;
28 [ -f "$input" ] || \\{ >&2 echo "INPUT: $input not found" ; exit 256; \\} && \\
29 [ -s "$input" ] || \\{ >&2 echo "INPUT: $input is empty"; \\} && \\
30 touch $input || \\{>&2 echo "INPUT: $input could not be touched. Please check your file permissions!"; exit 1; \\} && \\
31 EOF
32 0 ▶ if($output){
Branch: 1 branch
BranchTrueFalseTotal
if ($output) 0 0 0
33 0 $tprocess .=<<EOF;
34 touch $output || \\{>&2 echo "OUTPUT: $output could not be touched. Please check your file permissions!"; exit 1;\\} && \\
35 EOF
36 }
37 0 $tprocess .= $process;
38 0 $process = $tprocess;
39 }
40 0 ▶ if($output){
Branch: 1 branch
BranchTrueFalseTotal
if ($output) 0 0 0
41 0 $process = $process." && \\\n";
42 0 $tprocess =<<EOF;
43 [ -f "$output" ] || \\{>&2 echo "OUTPUT $output not found" ; \\} && \\
44 [ -s "$output" ] || \\{>&2 echo "OUTPUT $output is empty"; \\}
45 EOF
46 0 $process .= $tprocess;
47 }
48 0 $self->process($process);
49  
50 1 };
51  
52 1 1;
53 __END__
54  
55 =encoding utf-8
56  
57 =head1 NAME
58  
59 BioX::Workflow::Plugin::FileExists - a plugin to BioX::Workflow
60  
61 =head1 SYNOPSIS
62  
63 biox-workflow.pl --plugins FileExists
64  
65 =head1 DESCRIPTION
66  
67 BioX::Workflow::Plugin::FileExists is a plugin of BioX::Workflow that first checks that your local INPUT exists.
68 If it doesn't exist it will exit with 256.
69 If INPUT is empty it will give a warning.
70 If OUTPUT is empty or doesn't exist it will give a warning.
71  
72  
73 =head1 AUTHOR
74  
75 Jillian Rowe E<lt>jillian.e.rowe@gmail.comE<gt>
76  
77 =head1 COPYRIGHT
78  
79 Copyright 2016- Jillian Rowe
80  
81 =head1 LICENSE
82  
83 This library is free software; you can redistribute it and/or modify
84 it under the same terms as Perl itself.
85  
86 =head1 SEE ALSO
87  
88 =cut
↑ Summary Build »