TaskPipe/Task_SourceFromFile.pm

filter: Statementstmt 69.2% 9 / 13 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 2 / 3 Podpod 0.0% 0 / 1 totaltotal 64.7% 11 / 17 CC 1 SCAR 2.9
CC
1
Cov
69%
action
2.0
BEGIN
1.0
__ANON__
1.0
CRAP 1.3
« TaskPipe/Role/MooseType_ScopeMode.pm ↑ Summary TaskPipe/Tool/Command_StopJob.pm »
1 package TaskPipe::Task_SourceFromFile;
2  
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 extends 'TaskPipe::Task';
5 1 with 'MooseX::ConfigCascade';
6  
7 has path_settings => (is => 'rw', isa => 'TaskPipe::PathSettings', default => sub{
8 1 ▶ TaskPipe::PathSettings->new;
Subroutine __ANON__: called CC=1 SCAR=0.0
9 1 });
10  
11  
12 sub action{
13 0 ▶ my $self = shift;
Subroutine action: not called CC=1 SCAR=6.9
Pod undocumented
14  
15 my $filepath = $self->path_settings->path(
16 'source',
17 $self->param->{filename}
18 0 );
19  
20 0 my $list = $self->cascade_util->parser->( $filepath );
21 0 return $list;
22 }
23  
24 =head1 NAME
25  
26 TaskPipe::Task_SourceFromFile - use a file as a data source
27  
28 =head1 DESCRIPTION
29  
30 This is the standard task for reading from a yaml data file (and outputing the records as an arrayref). You can use this task directly. You should make sure the file the task is reading is in a format which will become an array when read by L<YAML::XS>. For example:
31  
32 ---
33 - url: https://www.example.com/first_record
34 headers:
35 Referer: https://www.example.com
36  
37 - url: https://www.example.com/second_record
38 Referer: https://www.example.com
39  
40 # ...
41  
42 In your plan, specify the task as follows:
43  
44 # (tree format):
45  
46 task:
47  
48 _name: SourceFromFile
49 filename: mydatafile.yml
50  
51 pipe_to:
52  
53 # ...
54  
55 =head1 AUTHOR
56  
57 Tom Gracey <tomgracey@gmail.com>
58  
59 =head1 COPYRIGHT AND LICENSE
60  
61 Copyright (c) Tom Gracey 2018
62  
63 TaskPipe is free software, licensed under
64  
65 The GNU Public License Version 3
66  
67 =cut
68  
69 1 __PACKAGE__->meta->make_immutable;
70 1 1;
71 __END__
« TaskPipe/Role/MooseType_ScopeMode.pm ↑ Summary TaskPipe/Tool/Command_StopJob.pm »