| 1 | 2 | ▶ | use strict; # redundant, but quiets perlcritic | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | package MooX::StrictConstructor::Role::Constructor::Late; | ||||||||||
| 4 | |||||||||||
| 5 | 2 | our $VERSION = '0.013'; | |||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Moo::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 2 | with 'MooX::StrictConstructor::Role::Constructor::Base'; | |||||||||
| 10 | |||||||||||
| 11 | 2 | has _buildall_generator => ( is => 'rw' ); | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | around buildall_generator => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 14 | 1 | my ($orig, $self, @args) = @_; | |||||||||
| 15 | 1 | my $gen = $self->_buildall_generator; | |||||||||
| 16 | 1 | ▶ | return $gen | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | if $gen; | ||||||||||
| 18 | 1 | $gen = Moo::Role->apply_roles_to_object($self->$orig(@args), | |||||||||
| 19 | 'MooX::StrictConstructor::Role::BuildAll' | ||||||||||
| 20 | ); | ||||||||||
| 21 | 1 | $gen->_constructor_generator($self); | |||||||||
| 22 | 1 | return $self->_buildall_generator($gen); | |||||||||
| 23 | 2 | }; | |||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | sub _fake_BUILD {} | ||||||||
|
Subroutine
_fake_BUILD: not called CC=1 SCAR=0.0
| |||||||||||
| 26 | |||||||||||
| 27 | 1 | ▶ | around generate_method => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||
| 28 | 1 | my ($orig, $self, $into, @args) = @_; | |||||||||
| 29 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | # this ensures BuildAll generation will always be done, but allows us to | ||||||||||
| 31 | # identify when the BUILD calls aren't needed. | ||||||||||
| 32 | 0 | ▶ | local *{"${into}::BUILD"} = \&_fake_BUILD | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | if !$into->can('BUILD'); | ||||||||||
| 34 | 1 | $self->$orig($into, @args); | |||||||||
| 35 | 2 | }; | |||||||||
| 36 | |||||||||||
| 37 | 2 | 1; | |||||||||
| 38 | |||||||||||
| 39 | __END__ | ||||||||||