Runner/Command/minion.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 90.9% 30 / 33 SCAR 13.9
CC
4
Cov
93%
run
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.0
« Minion/Util.pm ↑ Summary Minion/Command/run.pm »
1 package Beam::Runner::Command::minion;
2 3 our $VERSION = '0.016';
3 # ABSTRACT: Command for L<beam> 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<beam> command to delegate to
12 #pod the appropriate L<Beam::Minion::Command> subclass.
13 #pod
14 #pod =head1 SEE ALSO
15 #pod
16 #pod The L<Beam::Minion> commands: L<Beam::Minion::Command::run>,
17 #pod L<Beam::Minion::Command::worker>
18 #pod
19 #pod =cut
20  
21 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 3 ▶use Module::Runtime qw( use_module compose_module_name );
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 sub run {
26 4 ▶ my ( $class, $cmd, @args ) = @_;
Subroutine run: called CC=4 SCAR=13.9
Pod undocumented
27 4 ▶ if ( !$cmd ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($cmd) 1 3 4
28 1 die "ERROR: No 'beam minion' sub-command specified\n";
29 }
30 3 my $cmd_class = compose_module_name( 'Beam::Minion::Command', $cmd );
31 3 eval { use_module( $cmd_class ) };
32 3 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 1 2 3
33 1 ▶ if ( $@ =~ m{^Can't locate Beam/Minion/Command/} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@ =~ m[^Can't locate Beam/Minion/Command/]) 1 0 1
34 1 die "ERROR: No such sub-command: $cmd\n";
35 }
36 0 die "Error loading module '$cmd_class': $@\n";
37 }
38 2 return $cmd_class->new->run( @args );
39 }
40  
41 3 1;
42  
43 __END__
« Minion/Util.pm ↑ Summary Minion/Command/run.pm »