| 1 | package Bread::Board::SetterInjection; | ||
| 2 | 57 | our $AUTHORITY = 'cpan:STEVAN'; | |
| 3 | # ABSTRACT: service instantiating objects via setter functions | ||
| 4 | 57 | $Bread::Board::SetterInjection::VERSION = '0.37'; | |
| 5 | 57 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 57 | ▶ | use Bread::Board::Types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 57 | with 'Bread::Board::Service::WithConstructor', | |
| 10 | 'Bread::Board::Service::WithParameters', | ||
| 11 | 'Bread::Board::Service::WithDependencies'; | ||
| 12 | |||
| 13 | 57 | has '+class' => (required => 1); | |
| 14 | |||
| 15 | 10 | ▶ | sub get { |
|
Subroutine
get: called CC=2 SCAR=6.9
| |||
| 16 | 10 | my $self = shift; | |
| 17 | 10 | my $constructor = $self->constructor_name; | |
| 18 | 10 | my $o = $self->class->$constructor(); | |
| 19 | 10 | $o->$_($self->param($_)) foreach $self->param; | |
| 20 | 10 | return $o; | |
| 21 | } | ||
| 22 | |||
| 23 | 57 | __PACKAGE__->meta->make_immutable; | |
| 24 | |||
| 25 | 57 | ▶ | no Moose; 1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 26 | |||
| 27 | __END__ | ||