File Coverage

blib/lib/Beam/Runner/Command/minion.pm
Criterion Covered Total %
statement 19 20 95.0
branch 5 6 83.3
condition n/a
subroutine 4 4 100.0
pod 0 1 0.0
total 28 31 90.3


line stmt bran cond sub pod time code
1             package Beam::Runner::Command::minion;
2             our $VERSION = '0.016';
3             # ABSTRACT: Command for L to run distributed tasks
4              
5             #pod =head1 SYNOPSIS
6             #pod
7             #pod exit Beam::Runner::Command::minion->run( $cmd => @args );
8             #pod
9             #pod =head1 DESCRIPTION
10             #pod
11             #pod This is the entry point for the L command to delegate to
12             #pod the appropriate L subclass.
13             #pod
14             #pod =head1 SEE ALSO
15             #pod
16             #pod The L commands: L,
17             #pod L
18             #pod
19             #pod =cut
20              
21 2     2   74469 use strict;
  2         12  
  2         60  
22 2     2   10 use warnings;
  2         4  
  2         58  
23 2     2   488 use Module::Runtime qw( use_module compose_module_name );
  2         1677  
  2         12  
24              
25             sub run {
26 4     4 0 9982 my ( $class, $cmd, @args ) = @_;
27 4 100       13 if ( !$cmd ) {
28 1         7 die "ERROR: No 'beam minion' sub-command specified\n";
29             }
30 3         15 my $cmd_class = compose_module_name( 'Beam::Minion::Command', $cmd );
31 3         191 eval { use_module( $cmd_class ) };
  3         12  
32 3 100       706 if ( $@ ) {
33 1 50       6 if ( $@ =~ m{^Can't locate Beam/Minion/Command/} ) {
34 1         7 die "ERROR: No such sub-command: $cmd\n";
35             }
36 0         0 die "Error loading module '$cmd_class': $@\n";
37             }
38 2         11 return $cmd_class->new->run( @args );
39             }
40              
41             1;
42              
43             __END__