blib/lib/App/Pinto/Command/manual.pm

filter: Statementstmt 50.0% 14 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 100% 3 / 3 totaltotal 47.7% 21 / 44 CC 4 SCAR 16.9
CC
4
Cov
41%
execute
12.0
validate_args
6.0
command_names
2.0
CRAP 5.4
« blib/lib/App/Pinto/Command/diff.pm ↑ Summary blib/lib/App/Pinto/Command/merge.pm »
1 # ABSTRACT: show the full manual for a command
2  
3 package App::Pinto::Command::manual;
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Pod::Usage qw(pod2usage);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(App::Pinto::Command);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 #-------------------------------------------------------------------------------
13  
14 1 our $VERSION = '0.14'; # VERSION
15  
16 #-------------------------------------------------------------------------------
17  
18 0 ▶sub command_names { return qw( manual man --man ) }
Subroutine command_names: not called CC=1 SCAR=6.9
Pod documented
19  
20 #-----------------------------------------------------------------------------
21  
22 0 ▶sub validate_args {
Subroutine validate_args: not called CC=2 SCAR=17.9
Pod documented
23 0 my ( $self, $opts, $args ) = @_;
24  
25 0 ▶ $self->usage_error("Must specify a command") if @{$args} != 1;
Branch: 1 branch
BranchTrueFalseTotal
if @{$args;} != 1 0 0 0
26  
27 0 return 1;
28 }
29  
30 #-------------------------------------------------------------------------------
31 # This was stolen from App::Cmd::Command::help
32  
33 0 ▶sub execute {
Subroutine execute: not called CC=3 SCAR=24.8
Pod documented
34 0 my ( $self, $opts, $args ) = @_;
35  
36 0 my ( $cmd, undef, undef ) = $self->app->prepare_command(@$args);
37  
38 0 my $class = ref $cmd;
39  
40 # An invalid command name was specified, so the fallback command class
41 # was returned. Rather than showing the (unhelpful) manual for
42 # App::Cmd::Command::commands, we will just bail out and let App::Cmd
43 # show the usual 'unrecognized command' message.
44 0 ▶ return 1 if $class eq 'App::Cmd::Command::commands';
Branch: 1 branch
BranchTrueFalseTotal
if $class eq "App::Cmd::Command::commands" 0 0 0
45  
46 0 ( my $relative_path = $class ) =~ s< :: ></>xmsg;
47 0 $relative_path .= '.pm';
48  
49 0 ▶ my $absolute_path = $INC{$relative_path}
Branch: 1 branch
BranchTrueFalseTotal
my $absolute_path = $INC{$relative_path} or die "No manual available for $class\n" 0 0 0
50 or die "No manual available for $class\n";
51  
52 0 pod2usage( -verbose => 2, -input => $absolute_path, -exitval => 0 );
53  
54 0 return 1;
55 }
56  
57 #-------------------------------------------------------------------------------
58 1 1;
59  
60 __END__
« blib/lib/App/Pinto/Command/diff.pm ↑ Summary blib/lib/App/Pinto/Command/merge.pm »