File Coverage

blib/lib/MooseX/App/Plugin/Man/Command.pm
Criterion Covered Total %
statement 17 29 58.6
branch 0 4 0.0
condition 0 3 0.0
subroutine 6 7 85.7
pod 0 1 0.0
total 23 44 52.2


line stmt bran cond sub pod time code
1             # ============================================================================
2             package MooseX::App::Plugin::Man::Command;
3             # ============================================================================
4              
5 1     1   799 use 5.010;
  1         1  
6 1     1   4 use utf8;
  1         1  
  1         5  
7              
8 1     1   16 use namespace::autoclean;
  1         2  
  1         4  
9 1     1   47 use Moose;
  1         1  
  1         6  
10 1     1   4102 use MooseX::App::Command;
  1         1  
  1         8  
11 1     1   2395 use Pod::Perldoc;
  1         11213  
  1         185  
12              
13             command_short_description q(Full manpage);
14              
15             has 'command' => (
16             is => 'ro',
17             isa => 'ArrayRef',
18             predicate => 'has_command',
19             documentation => q[Command],
20             traits => ['MooseX::App::Meta::Role::Attribute::Option'],
21             cmd_type => 'parameter',
22             cmd_position => 1,
23             );
24              
25             sub man {
26 0     0 0   my ($self,$app) = @_;
27              
28 0           my $meta = $app->meta;
29 0           my $class;
30              
31 0 0         if ($self->has_command) {
32 0           my $return = $meta->command_find($self->command);
33             # Nothing found
34 0 0 0       if (blessed $return
35             && $return->isa('MooseX::App::Message::Block')) {
36 0           return MooseX::App::Message::Envelope->new(
37             $return,
38             $meta->command_usage_command($self->meta),
39             );
40             }
41 0           $class = $meta->command_get($return);
42             } else {
43 0           $class = $meta->name;
44             }
45              
46 0           Class::Load::load_class($class);
47 0           my $filename = MooseX::App::Utils::package_to_filename($class);
48              
49 0           exec('perldoc',$filename);
50             #return $MooseX::App::Null::NULL;
51             }
52              
53             __PACKAGE__->meta->make_immutable;
54             1;