line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# App::hopen::G::OutputPerFileCmd - hopen Cmd that makes outputs from input separately |
2
|
|
|
|
|
|
|
package App::hopen::G::OutputPerFileCmd; |
3
|
1
|
|
|
1
|
|
476
|
use Data::Hopen; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
57
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
5
|
use Data::Hopen::Base; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.000013'; # TRIAL |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1316
|
use parent 'App::hopen::G::Cmd'; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
6
|
|
10
|
1
|
|
|
1
|
|
74
|
use Class::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
43
|
use Data::Hopen::Util::Data qw(forward_opts); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
429
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Docs {{{1 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
App::hopen::G::OutputPerFileCmd - hopen Cmd that makes outputs for each input separately |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
In a Cmd package: |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
use parent 'App::hopen::G::OutputPerFileCmd'; |
25
|
|
|
|
|
|
|
use Class::Tiny; |
26
|
|
|
|
|
|
|
sub _process_input { |
27
|
|
|
|
|
|
|
my ($self, $source_asset) = @_; |
28
|
|
|
|
|
|
|
# $source_asset is an App::hopen::Asset |
29
|
|
|
|
|
|
|
... # Return a list of [$asset, $how] arrayrefs |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# }}}1 |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 FUNCTIONS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head2 _process_input |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
Makes output assets for a given input asset. Must be implemented |
41
|
|
|
|
|
|
|
by subclasses. Called as: |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
$self->_process_input(-asset=>$asset, -visitor=>$visitor); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
Returns a list of arrayrefs of C<[$asset, $how]>. C<$how> defaults to C<undef>. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _process_input { |
50
|
|
|
|
|
|
|
... |
51
|
0
|
|
|
0
|
|
0
|
} #_process_input() |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 _should_act |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Returns truthy if L</_process_input> should be called. Must be implemented |
56
|
|
|
|
|
|
|
by subclasses. Called as: |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$self->_should_act(-phase=>$phase, -visitor=>$visitor); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=cut |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub _should_act { |
63
|
|
|
|
|
|
|
... |
64
|
0
|
|
|
0
|
|
0
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 _run |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Creates the output list by calling L</_process_input>. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=cut |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub _run { |
73
|
3
|
|
|
3
|
|
991
|
my ($self, %args) = getparameters('self', [qw(visitor ; *)], @_); |
74
|
|
|
|
|
|
|
|
75
|
3
|
50
|
|
|
|
229
|
return $self->passthrough(-nocontext=>1) unless |
76
|
|
|
|
|
|
|
$self->_should_act(forward_opts(\%args, {'-'=>1}, qw(visitor))); |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Pull the inputs |
79
|
3
|
|
|
|
|
23
|
my $lrSourceFiles = $self->input_assets; |
80
|
3
|
|
|
0
|
|
26
|
hlog { 'found source files', Dumper($lrSourceFiles) } 2; |
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
|
82
|
3
|
|
|
|
|
29
|
my @outputs; |
83
|
3
|
|
|
|
|
9
|
foreach my $src (@$lrSourceFiles) { |
84
|
3
|
|
|
|
|
19
|
my @outputs_here = $self->_process_input(-asset=>$src, |
85
|
|
|
|
|
|
|
forward_opts(\%args, {'-'=>1}, qw(visitor))); |
86
|
|
|
|
|
|
|
|
87
|
3
|
|
|
|
|
13
|
foreach my $lrOutput (@outputs_here) { |
88
|
3
|
|
|
|
|
8
|
my ($obj, $how) = @$lrOutput; |
89
|
3
|
|
|
|
|
10
|
push @outputs, $obj; |
90
|
3
|
|
|
|
|
28
|
$args{visitor}->asset($obj, -how => $how); |
91
|
3
|
|
|
|
|
36
|
$args{visitor}->connect($src, $obj); |
92
|
|
|
|
|
|
|
} #foreach $lrOutput |
93
|
|
|
|
|
|
|
} #foreach $src |
94
|
|
|
|
|
|
|
|
95
|
3
|
|
|
|
|
1426
|
$self->make(\@outputs); |
96
|
3
|
|
|
|
|
19
|
return {}; |
97
|
|
|
|
|
|
|
} #_run() |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
__END__ |
102
|
|
|
|
|
|
|
# vi: set fdm=marker: # |