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 | 8 | no warnings qw(redefine); | |||
1 | 2 | ||||||
1 | 41 | ||||||
4 | 1 | 1 | 5 | use Getopt::App; | |||
1 | 2 | ||||||
1 | 6 | ||||||
5 | 4 | 4 | 12 | sub getopt_subcommands { [] } | |||
6 | |||||||
7 | sub getopt_unknown_subcommand { | ||||||
8 | 3 | 3 | 6 | my ($self, $argv) = @_; | |||
9 | 3 | 8 | $self->{unknown} = int @$argv; | ||||
10 | 3 | 100 | 31 | 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 }); |