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.014';
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 1     1   1513 use strict;
  1         2  
  1         22  
22 1     1   4 use warnings;
  1         2  
  1         22  
23 1     1   4 use Module::Runtime qw( use_module compose_module_name );
  1         1  
  1         5  
24              
25             sub run {
26 3     3 0 5083 my ( $class, $cmd, @args ) = @_;
27 3 100       6 if ( !$cmd ) {
28 1         6 die "ERROR: No 'beam minion' sub-command specified\n";
29             }
30 2         4 my $cmd_class = compose_module_name( 'Beam::Minion::Command', $cmd );
31 2         59 eval { use_module( $cmd_class ) };
  2         5  
32 2 100       518 if ( $@ ) {
33 1 50       4 if ( $@ =~ m{^Can't locate Beam/Minion/Command/} ) {
34 1         6 die "ERROR: No such sub-command: $cmd\n";
35             }
36 0         0 die "Error loading module '$cmd_class': $@\n";
37             }
38 1         5 return $cmd_class->run( @args );
39             }
40              
41             1;
42              
43             __END__