example/lib/Test/Cool/commands/unknown.pl | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 10 | 10 | 100.0 |
branch | 4 | 4 | 100.0 |
condition | n/a | ||
subroutine | 4 | 4 | 100.0 |
pod | n/a | ||
total | 18 | 18 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | #!/usr/bin/env perl | ||||||
2 | package Test::Cool::unknown; | ||||||
3 | 1 | 1 | 10 | no warnings qw(redefine); | |||
1 | 3 | ||||||
1 | 45 | ||||||
4 | 1 | 1 | 7 | use Getopt::App; | |||
1 | 2 | ||||||
1 | 7 | ||||||
5 | 4 | 4 | 13 | sub getopt_subcommands { [] } | |||
6 | |||||||
7 | sub getopt_unknown_subcommand { | ||||||
8 | 3 | 3 | 5 | my ($self, $argv) = @_; | |||
9 | 3 | 11 | $self->{unknown} = int @$argv; | ||||
10 | 3 | 100 | 33 | return $argv->[0] eq 'die' ? die 'not cool' : $argv->[0] =~ m!^(\d+)! ? $argv->[0] : undef; | |||
100 | |||||||
11 | } | ||||||
12 | |||||||
13 | run(sub { say shift->{unknown} ? 'unknown' : 'ok'; return 0 }); |