Runner/Command/run.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 4 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 88.2% 45 / 51 CC 5 SCAR 10.5
CC
5
Cov
92%
run
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Runner/Command/list.pm ↑ Summary Runner/Command/help.pm »
1 package Beam::Runner::Command::run;
2 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 <container> <service> [<args...>]
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<beam>, L<Beam::Runner::Command>, L<Beam::Runner>
16 #pod
17 #pod =cut
18  
19 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶use Beam::Wire;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Path::Tiny qw( path );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Scalar::Util qw( blessed );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use Beam::Runner::Util qw( find_container_path );
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 5 ▶sub run {
Subroutine run: called CC=5 SCAR=16.3
Pod undocumented
27 5 my ( $class, $container, $service_name, @args ) = @_;
28 5 my $path = find_container_path( $container );
29 4 my $wire = Beam::Wire->new(
30 file => $path,
31 );
32  
33 4 my $service = eval { $wire->get( $service_name ) };
34 4 ▶ if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 2 2 4
35 2 ▶ if ( blessed $@ && $@->isa( 'Beam::Wire::Exception::NotFound' ) && $@->name eq $service_name ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($@) and $@->isa("Beam::Wire::Exception::NotFound") and $@->name eq $service_name) 1 1 2
Condition50%3/6
builtin::blessed($@) and $@->isa("Beam::Wire::Exception::NotFound") and $@->name eq $service_name
!ll&&!rl&&r
011
builtin::blessed($@) and $@->isa("Beam::Wire::Exception::NotFound")
!ll&&!rl&&r
002
MC/DC33%1/3
builtin::blessed($@) and $@->isa("Beam::Wire::Exception::NotFound") and $@->name eq $service_name
builtin::blessed($@) $@->isa("Beam::Wire::Exception::NotFound") $@->name eq $service_name
Truth table50%2/4
A and B and C
A= builtin::blessed($@)B= $@->isa("Beam::Wire::Exception::NotFound")C= $@->name eq $service_name
ABCresult
0XX0
10X0
1100
1111
36 1 die sprintf qq{Could not find service "%s" in container "%s"\n},
37 $service_name, $path;
38 }
39 1 die sprintf qq{Could not load service "%s" in container "%s": %s\n}, $service_name, $path, $@;
40 }
41  
42 2 return $service->run( @args );
43 }
44  
45 2 1;
46  
47 __END__
« Runner/Command/list.pm ↑ Summary Runner/Command/help.pm »