lib/App/Yath/Script/V0.pm

filter: Statementstmt 93.5% 29 / 31 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 80.8% 38 / 47 CC 6 SCAR 11.7
CC
6
Cov
86%
do_begin
5.5
do_runtime
2.0
BEGIN
1.0
CRAP 3.2
« lib/App/Yath/Script.pm ↑ Summary scripts/yath »
1 package App::Yath::Script::V0;
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 14 ▶use Getopt::Yath;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 14 our $VERSION = '2.000017';
8  
9 14 my @BEGIN_ARGS;
10  
11 14 ▶option_group {group => 'v0', category => 'V0 Options'} => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
12 14 option begin => (
13 type => 'List',
14 description => 'Arguments to process during the BEGIN phase',
15 );
16  
17 14 option goto_file => (
18 type => 'Scalar',
19 description => 'Use goto::file to switch to a different file during BEGIN (for testing)',
20 );
21 14 };
22  
23 14 ▶sub do_begin {
Subroutine do_begin: called CC=5 SCAR=17.0
Pod undocumented
24 14 my $class = shift;
25 14 my %params = @_;
26  
27 14 my $argv = $params{argv};
28  
29 14 my $state = parse_options($argv, skip_non_opts => 1);
30 14 ▶ @BEGIN_ARGS = @{$state->{settings}->v0->begin // []};
Condition50%1/2
$state->{"settings"}->v0->begin // []
l!l
140
MC/DC0%0/1
$state->{"settings"}->v0->begin // []
$state->{"settings"}->v0->begin
Truth table50%1/2
A
A= $state->{"settings"}->v0->begin
Aresult
11
00
31  
32 # Non-option args go back into @ARGV for do_runtime
33 14 ▶ @ARGV = @{$state->{skipped} // []};
Condition50%1/2
$state->{"skipped"} // []
l!l
140
MC/DC0%0/1
$state->{"skipped"} // []
$state->{"skipped"}
Truth table50%1/2
A
A= $state->{"skipped"}
Aresult
11
00
34  
35 14 print "BEGIN: $_\n" for @BEGIN_ARGS;
36  
37 14 my $goto = $state->{settings}->v0->goto_file;
38 14 ▶ if ($goto) {
Branch: 1 branch
BranchTrueFalseTotal
if ($goto) 0 14 14
39 0 require goto::file;
40 0 goto::file->import($goto);
41 }
42 }
43  
44 14 ▶sub do_runtime {
Subroutine do_runtime: called CC=2 SCAR=6.9
Pod undocumented
45 14 my $class = shift;
46  
47 14 print "RUNTIME: $_\n" for @ARGV;
48  
49 14 return 0;
50 }
51  
52 14 1;
53  
54 __END__
« lib/App/Yath/Script.pm ↑ Summary scripts/yath »