Bolts/Blueprint/Factory.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
builder
1.0
CRAP 1.0
« Bolts/Blueprint/BuiltInjector.pm ↑ Summary Bolts/Blueprint/Literal.pm »
1 package Bolts::Blueprint::Factory;
2 11 $Bolts::Blueprint::Factory::VERSION = '0.143171';
3 # ABSTRACT: Build an artifact by calling a class method on a class
4  
5 11 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 with 'Bolts::Blueprint';
8  
9 11 ▶use Class::Load ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 11 has class => (
13 is => 'ro',
14 isa => 'Str',
15 required => 1,
16 );
17  
18  
19 11 has method => (
20 is => 'ro',
21 isa => 'Str',
22 required => 1,
23 default => 'new',
24 );
25  
26  
27 224 ▶sub builder {
Subroutine builder: called CC=1 SCAR=0.0
Pod documented
28 224 my ($self, $bag, $name, @params) = @_;
29  
30 224 my $class = $self->class;
31 224 my $method = $self->method;
32  
33 224 Class::Load::load_class($class);
34  
35 224 return $class->$method(@params);
36 }
37  
38 11 __PACKAGE__->meta->make_immutable;
39  
40 __END__
« Bolts/Blueprint/BuiltInjector.pm ↑ Summary Bolts/Blueprint/Literal.pm »