File Coverage

blib/lib/App/MatrixTool/SubCommands.pm
Criterion Covered Total %
statement 12 19 63.1
branch 0 2 0.0
condition n/a
subroutine 4 5 80.0
pod 0 1 0.0
total 16 27 59.2


line stmt bran cond sub pod time code
1             # You may distribute under the terms of either the GNU General Public License
2             # or the Artistic License (the same terms as Perl itself)
3             #
4             # (C) Paul Evans, 2016 -- leonerd@leonerd.org.uk
5              
6             package App::MatrixTool::SubCommands;
7              
8 1     1   4 use strict;
  1         1  
  1         23  
9 1     1   2 use warnings;
  1         1  
  1         18  
10 1     1   3 use base qw( App::MatrixTool );
  1         1  
  1         59  
11              
12 1     1   3 use constant ARGUMENTS => ( "command", "..." );
  1         1  
  1         121  
13              
14             sub run
15             {
16 0     0 0   my $self = shift;
17 0           my @args = @_;
18              
19 0           my $cmd = shift @args;
20              
21 0           my $pkg = $self->_pkg_for_command( $cmd );
22 0 0         $pkg->can( "new" ) or
23             return $self->error( "No such command '$cmd'" );
24              
25             # TODO: ponder global opts?
26 0           my $runner = $pkg->new( %$self );
27              
28 0           $self->run_command_in_runner( $runner, @args );
29             }
30              
31             0x55AA;