line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BioX::Workflow::Command::run::Rules::Directives::Interpolate::Text; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
950
|
use Moose::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
4
|
1
|
|
|
1
|
|
4410
|
use namespace::autoclean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
544
|
use Text::Template; |
|
1
|
|
|
|
|
2368
|
|
|
1
|
|
|
|
|
38
|
|
7
|
1
|
|
|
1
|
|
7
|
use Try::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
49
|
|
8
|
1
|
|
|
1
|
|
327
|
use Safe; |
|
1
|
|
|
|
|
12175
|
|
|
1
|
|
|
|
|
48
|
|
9
|
1
|
|
|
1
|
|
8
|
use Storable qw(dclone); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
10
|
1
|
|
|
1
|
|
7
|
use File::Spec; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
11
|
1
|
|
|
1
|
|
469
|
use Memoize; |
|
1
|
|
|
|
|
1804
|
|
|
1
|
|
|
|
|
47
|
|
12
|
1
|
|
|
1
|
|
7
|
use File::Basename; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
350
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $c = new Safe; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub interpol_directive { |
17
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
18
|
0
|
|
|
|
|
|
my $source = shift; |
19
|
0
|
|
|
|
|
|
my $text = ''; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
#The $ is not always at the beginning |
22
|
0
|
0
|
0
|
|
|
|
if ( exists $self->interpol_directive_cache->{$source} && $source !~ m/{/ ) |
23
|
|
|
|
|
|
|
{ |
24
|
0
|
|
|
|
|
|
return $self->interpol_directive_cache->{$source}; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
if ( $source !~ m/{/ ) { |
28
|
0
|
|
|
|
|
|
$self->interpol_directive_cache->{$source} = $source; |
29
|
0
|
|
|
|
|
|
return $source; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
my $template = Text::Template->new( |
33
|
|
|
|
|
|
|
TYPE => 'STRING', |
34
|
|
|
|
|
|
|
SOURCE => $source, |
35
|
|
|
|
|
|
|
SAFE => $c, |
36
|
|
|
|
|
|
|
); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $fill_in = { self => \$self }; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
#TODO reference keys by value instead of $self-> |
41
|
|
|
|
|
|
|
# my @keys = keys %{$self}; |
42
|
|
|
|
|
|
|
# $fill_in->{INPUT} = $self->INPUT; |
43
|
0
|
0
|
|
|
|
|
$fill_in->{sample} = $self->sample if $self->has_sample; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
$text = $template->fill_in( |
46
|
|
|
|
|
|
|
HASH => $fill_in, |
47
|
|
|
|
|
|
|
BROKEN => \&my_broken, |
48
|
|
|
|
|
|
|
PREPEND => "use File::Glob; use File::Basename;\n" |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
$self->interpol_directive_cache->{$source} = $text; |
52
|
0
|
|
|
|
|
|
return $text; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
memoize('my_broken'); |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub my_broken { |
58
|
|
|
|
|
|
|
my %args = @_; |
59
|
|
|
|
|
|
|
my $err_ref = $args{arg}; |
60
|
|
|
|
|
|
|
my $text = $args{text}; |
61
|
|
|
|
|
|
|
my $error = $args{error}; |
62
|
|
|
|
|
|
|
$error =~ s/via package.*//g; |
63
|
|
|
|
|
|
|
chomp($error); |
64
|
|
|
|
|
|
|
if ( $error =~ m/Can't locate object method/ ) { |
65
|
|
|
|
|
|
|
$error .= "\n# Did you declare $text?"; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
return <<EOF; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
################################################### |
71
|
|
|
|
|
|
|
# The following errors were encountered: |
72
|
|
|
|
|
|
|
# $text |
73
|
|
|
|
|
|
|
# $error |
74
|
|
|
|
|
|
|
################################################### |
75
|
|
|
|
|
|
|
EOF |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |