File Coverage

blib/lib/App/Yath/Script/V0.pm
Criterion Covered Total %
statement 23 25 92.0
branch 1 2 50.0
condition 2 4 50.0
subroutine 5 5 100.0
pod 0 2 0.0
total 31 38 81.5


line stmt bran cond sub pod time code
1             package App::Yath::Script::V0;
2 14     14   210028 use strict;
  14         24  
  14         543  
3 14     14   81 use warnings;
  14         64  
  14         933  
4              
5 14     14   7201 use Getopt::Yath;
  14         1465471  
  14         92  
6              
7             our $VERSION = '2.000016';
8              
9             my @BEGIN_ARGS;
10              
11             option_group {group => 'v0', category => 'V0 Options'} => sub {
12             option begin => (
13             type => 'List',
14             description => 'Arguments to process during the BEGIN phase',
15             );
16              
17             option goto_file => (
18             type => 'Scalar',
19             description => 'Use goto::file to switch to a different file during BEGIN (for testing)',
20             );
21             };
22              
23             sub do_begin {
24 14     14 0 262006 my $class = shift;
25 14         94 my %params = @_;
26              
27 14         33 my $argv = $params{argv};
28              
29 14         68 my $state = parse_options($argv, skip_non_opts => 1);
30 14   50     10385 @BEGIN_ARGS = @{$state->{settings}->v0->begin // []};
  14         199  
31              
32             # Non-option args go back into @ARGV for do_runtime
33 14   50     838 @ARGV = @{$state->{skipped} // []};
  14         96  
34              
35 14         118 print "BEGIN: $_\n" for @BEGIN_ARGS;
36              
37 14         125 my $goto = $state->{settings}->v0->goto_file;
38 14 50       776 if ($goto) {
39 0         0 require goto::file;
40 0         0 goto::file->import($goto);
41             }
42             }
43              
44             sub do_runtime {
45 14     14 0 7869 my $class = shift;
46              
47 14         122 print "RUNTIME: $_\n" for @ARGV;
48              
49 14         1078 return 0;
50             }
51              
52             1;
53              
54             __END__