Board/ConstructorInjection.pm

filter: Statementstmt 100% 22 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Board/BlockInjection.pm ↑ Summary Board/Container/FromParameterized.pm »
1 package Bread::Board::ConstructorInjection;
2 63 our $AUTHORITY = 'cpan:STEVAN';
3 # ABSTRACT: service instantiating objects via a constructor
4 63 $Bread::Board::ConstructorInjection::VERSION = '0.37';
5 63 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 63 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 63 ▶use Bread::Board::Types;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 63 with 'Bread::Board::Service::WithConstructor',
12 'Bread::Board::Service::WithParameters',
13 'Bread::Board::Service::WithDependencies';
14  
15 63 has '+class' => (required => 1);
16  
17 161 ▶sub get {
Subroutine get: called CC=1 SCAR=0.0
18 161 my $self = shift;
19  
20 161 my $constructor = $self->constructor_name;
21 161 $self->class->$constructor( %{ $self->params } );
22 }
23  
24 63 __PACKAGE__->meta->make_immutable;
25  
26 63 ▶no Moose; 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 __END__
« Board/BlockInjection.pm ↑ Summary Board/Container/FromParameterized.pm »