| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Beam::Runner::Command::run; |
|
2
|
|
|
|
|
|
|
our $VERSION = '0.016'; |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Run the given service with the given arguments |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
#pod =head1 SYNOPSIS |
|
6
|
|
|
|
|
|
|
#pod |
|
7
|
|
|
|
|
|
|
#pod beam run [] |
|
8
|
|
|
|
|
|
|
#pod |
|
9
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
|
10
|
|
|
|
|
|
|
#pod |
|
11
|
|
|
|
|
|
|
#pod Run a service from the given container, passing in any arguments. |
|
12
|
|
|
|
|
|
|
#pod |
|
13
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
|
14
|
|
|
|
|
|
|
#pod |
|
15
|
|
|
|
|
|
|
#pod L, L, L |
|
16
|
|
|
|
|
|
|
#pod |
|
17
|
|
|
|
|
|
|
#pod =cut |
|
18
|
|
|
|
|
|
|
|
|
19
|
1
|
|
|
1
|
|
20854
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
20
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
26
|
|
|
21
|
1
|
|
|
1
|
|
575
|
use Beam::Wire; |
|
|
1
|
|
|
|
|
396183
|
|
|
|
1
|
|
|
|
|
43
|
|
|
22
|
1
|
|
|
1
|
|
8
|
use Path::Tiny qw( path ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
61
|
|
|
23
|
1
|
|
|
1
|
|
7
|
use Scalar::Util qw( blessed ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
24
|
1
|
|
|
1
|
|
440
|
use Beam::Runner::Util qw( find_container_path ); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
196
|
|
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub run { |
|
27
|
5
|
|
|
5
|
0
|
14728
|
my ( $class, $container, $service_name, @args ) = @_; |
|
28
|
5
|
|
|
|
|
22
|
my $path = find_container_path( $container ); |
|
29
|
4
|
|
|
|
|
112
|
my $wire = Beam::Wire->new( |
|
30
|
|
|
|
|
|
|
file => $path, |
|
31
|
|
|
|
|
|
|
); |
|
32
|
|
|
|
|
|
|
|
|
33
|
4
|
|
|
|
|
105097
|
my $service = eval { $wire->get( $service_name ) }; |
|
|
4
|
|
|
|
|
22
|
|
|
34
|
4
|
100
|
|
|
|
8545
|
if ( $@ ) { |
|
35
|
2
|
100
|
33
|
|
|
268
|
if ( blessed $@ && $@->isa( 'Beam::Wire::Exception::NotFound' ) && $@->name eq $service_name ) { |
|
|
|
|
66
|
|
|
|
|
|
36
|
1
|
|
|
|
|
10
|
die sprintf qq{Could not find service "%s" in container "%s"\n}, |
|
37
|
|
|
|
|
|
|
$service_name, $path; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
1
|
|
|
|
|
8
|
die sprintf qq{Could not load service "%s" in container "%s": %s\n}, $service_name, $path, $@; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
11
|
return $service->run( @args ); |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
1; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__END__ |