Rssfilter/Cmd/runfromconfig.pm untested

filter: Statementstmt 0.0% 0 / 42 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod n/a totaltotal 0.0% 0 / 59 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # ABSTRACT: fetch feeds and constrain with rules, all from a config file
2  
3  
4 use strict;
5 use warnings;
6  
7 package App::Rssfilter::Cmd::runfromconfig;
8 {
9 $App::Rssfilter::Cmd::runfromconfig::VERSION = '0.07';
10 }
11  
12 use App::Rssfilter::Cmd -command;
13 use App::Rssfilter;
14 use Method::Signatures;
15 use Cwd;
16 use Path::Class qw<>;
17 use Log::Any::Adapter;
18  
19 method usage_desc( $app ) {
20 return $app->arg0 . ' %o';
21 }
22  
23  
24 method opt_spec( $app ) {
25 return (
26 [ 'config-file|f:s', 'config file for App::Rssfilter (searches for RssFilter.yaml if not set)', ],
27 [ 'log|v', 'turn logging on' ],
28 );
29 }
30  
31 method validate_args( $opt, $args ) { }
32  
33 method find_config( :$file = 'Rssfilter.yaml', :$dir = cwd() ) {
34 $dir = Path::Class::dir->new( $dir )->absolute;
35 for( reverse $dir->dir_list ) {
36 my $filename = $dir->file( $file );
37 return $filename if -r $filename;
38 last; # directory search later
39 $dir = $dir->parent;
40 }
41 return $file;
42 }
43  
44 method execute( $opt, $args ) {
45 my $yaml_config = Path::Class::file( $opt->config_file // $self->find_config );
46 Log::Any::Adapter->set( 'Stdout' ) if $opt->log;
47 App::Rssfilter->from_yaml( scalar $yaml_config->slurp )->update();
48 }
49  
50 1;
51  
52 __END__