File Coverage

blib/lib/CLI/Osprey/InlineSubcommand.pm
Criterion Covered Total %
statement 12 22 54.5
branch n/a
condition n/a
subroutine 4 6 66.6
pod 0 2 0.0
total 16 30 53.3


line stmt bran cond sub pod time code
1             package CLI::Osprey::InlineSubcommand;
2 4     4   27 use strict;
  4         10  
  4         123  
3 4     4   21 use warnings;
  4         9  
  4         116  
4 4     4   30 use Moo;
  4         13  
  4         27  
5              
6             # ABSTRACT: A class to wrap coderef subcommands
7             our $VERSION = '0.06'; # VERSION
8             our $AUTHORITY = 'cpan:ARODLAND'; # AUTHORITY
9              
10             has 'name' => (
11             is => 'ro',
12             required => 1,
13             );
14              
15             has 'desc' => (
16             is => 'bare',
17             reader => '_osprey_subcommand_desc',
18             );
19              
20             has 'method' => (
21             is => 'ro',
22             required => 1,
23             );
24              
25             has 'parent_command' => (
26             is => 'rw',
27             );
28              
29             has 'argv' => (
30             is => 'rw',
31             );
32              
33             sub new_with_options {
34 0     0 0   my ($self, %args) = @_;
35 0           $self->parent_command($args{ parent_command });
36 0           $self->argv([ @ARGV ]);
37 0           return $self;
38             }
39              
40             sub run {
41 0     0 0   my ($self) = @_;
42 0           my $cmd = $self->parent_command;
43 0           my $method = $self->method;
44              
45 0           @_ = ($self->parent_command, @{ $self->argv });
  0            
46 0           goto &$method;
47             }
48              
49 4     4   2219 no Moo;
  4         8  
  4         29  
50             1;
51              
52             __END__