| 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
| |||||||||||
| 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
| |||||||||||
| 33 | 1 | ▶ | if ( $@ =~ m{^Can't locate Beam/Minion/Command/} ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 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__ | ||||||||||