Sietima/CmdLine.pm

filter: Statementstmt 100% 40 / 40 Branchbran n/a Conditioncond 71.4% 5 / 7 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 12 / 12 Podpod 0.0% 0 / 1 totaltotal 90.6% 58 / 64 CC 4 SCAR 6.0
CC
4
Cov
96%
BUILDARGS
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Sietima/Role/Debounce.pm ↑ Summary Sietima/Role/SubscriberOnly.pm »
1 package Sietima::CmdLine;
2 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Sietima::Policy;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Sietima::Types qw(SietimaObj);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Types::Standard qw(HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Sietima;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use App::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Sietima::Runner;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $VERSION = '1.1.5'; # VERSION
12 # ABSTRACT: run Sietima as a command-line application
13  
14  
15 1 has sietima => (
16 is => 'ro',
17 required => 1,
18 isa => SietimaObj,
19 );
20  
21  
22 has extra_spec => (
23 is => 'ro',
24 isa => HashRef,
25 3 ▶ default => sub { +{} },
Subroutine __ANON__: called CC=1 SCAR=0.0
26 1 );
27  
28  
29 4 ▶sub BUILDARGS($class,@args) {
Subroutine BUILDARGS: called CC=4 SCAR=14.0
Pod undocumented
30 4 my $args = $class->next::method(@args);
31 4 ▶ $args->{sietima} //= do {
Condition66%2/3
$args->{"sietima"} //= do { my $traits = delete $args->{"traits"} // []; my $constructor_args = delete $args->{"args"} // {}; "Sietima"->with_traits(@$traits)->new($constructor_args) }
l!l&&r!l&&!r
130
MC/DC0%0/2
$args->{"sietima"} //= do { my $traits = delete $args->{"traits"} // []; my $constructor_args = delete $args->{"args"} // {}; "Sietima"->with_traits(@$traits)->new($constructor_args) }
$args->{"sietima"} do { my $traits = delete $args->{"traits"} // []; my $constructor_args = delete $args->{"args"} // {}; "Sietima"->with_traits(@$traits)->new($constructor_args) }
Truth table66%2/3
A //= B
A= $args->{"sietima"}B= do { my $traits = delete $args->{"traits"} // []; my $constructor_args = delete $args->{"args"} // {}; "Sietima"->with_traits(@$traits)->new($constructor_args) }
ABresult
1X1
011
000
32 3 ▶ my $traits = delete $args->{traits} // [];
Condition100%2/2
delete $args->{"traits"} // []
l!l
12
MC/DC100%1/1
delete $args->{"traits"} // []
delete $args->{"traits"}
Truth table100%2/2
A
A= delete $args->{"traits"}
Aresult
11
00
33 3 ▶ my $constructor_args = delete $args->{args} // {};
Condition50%1/2
delete $args->{"args"} // {}
l!l
30
MC/DC0%0/1
delete $args->{"args"} // {}
delete $args->{"args"}
Truth table50%1/2
A
A= delete $args->{"args"}
Aresult
11
00
34 3 Sietima->with_traits($traits->@*)->new($constructor_args);
35 };
36 4 return $args;
37 }
38  
39  
40 1 has app_spec => (
41 is => 'lazy',
42 init_arg => undef,
43 );
44  
45 2 ▶sub _build_app_spec($self) {
Subroutine _build_app_spec: called CC=1 SCAR=0.0
46 2 my $spec_data = $self->sietima->command_line_spec();
47  
48 2 return App::Spec->read({
49 $spec_data->%*,
50 $self->extra_spec->%*,
51  
52 # App::Spec 0.005 really wants a class name, even when we pass
53 # a pre-build cmd object to the Runner
54 class => ref($self->sietima),
55 });
56 }
57  
58  
59 1 has runner => (
60 is => 'lazy',
61 init_arg => undef,
62 handles => [qw(run)],
63 );
64  
65 1 ▶sub _build_runner($self) {
Subroutine _build_runner: called CC=1 SCAR=0.0
66 1 return Sietima::Runner->new({
67 spec => $self->app_spec,
68 cmd => $self->sietima,
69 });
70 }
71  
72 1 1;
73  
74 __END__
« Sietima/Role/Debounce.pm ↑ Summary Sietima/Role/SubscriberOnly.pm »