« blib/lib/Moose/Meta/TypeConstraint/Parameterizable.pm
↑ Summary
blib/lib/Moose/Meta/TypeConstraint/Union.pm »
| 1 | package Moose::Meta::Method::Constructor; | ||||||||||||||||||||||||||||
| 2 | 388 | our $VERSION = '2.4001'; | |||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 388 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 388 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 388 | ▶ | use Scalar::Util 'weaken'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 388 | ▶ | use parent 'Moose::Meta::Method', | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 388 | 'Class::MOP::Method::Constructor'; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 388 | ▶ | use Moose::Util 'throw_exception'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 764 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.2
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 764 | my $class = shift; | |||||||||||||||||||||||||||
| 16 | 764 | my %options = @_; | |||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 764 | my $meta = $options{metaclass}; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 764 | ▶ | (ref $options{options} eq 'HASH') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 21 | || throw_exception( MustPassAHashOfOptions => params => \%options, | ||||||||||||||||||||||||||||
| 22 | class => $class | ||||||||||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | ($options{package_name} && $options{name}) | ||||||||||||||||||||||||||||
| 26 | 763 | ▶ | || throw_exception( MustSupplyPackageNameAndName => params => \%options, | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$options{"package_name"} and $options{"name"}
MC/DC50%1/2
$options{"package_name"} and $options{"name"}
$options{"package_name"}
$options{"name"}
Truth table66%2/3
A and B
A= $options{"package_name"}B= $options{"name"}
| |||||||||||||||||||||||||||||
| 27 | class => $class | ||||||||||||||||||||||||||||
| 28 | ); | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | my $self = bless { | ||||||||||||||||||||||||||||
| 31 | 'body' => undef, | ||||||||||||||||||||||||||||
| 32 | 'package_name' => $options{package_name}, | ||||||||||||||||||||||||||||
| 33 | 'name' => $options{name}, | ||||||||||||||||||||||||||||
| 34 | 'options' => $options{options}, | ||||||||||||||||||||||||||||
| 35 | 'associated_metaclass' => $meta, | ||||||||||||||||||||||||||||
| 36 | 'definition_context' => $options{definition_context}, | ||||||||||||||||||||||||||||
| 37 | 762 | ▶ | '_expected_method_class' => $options{_expected_method_class} || 'Moose::Object', | ||||||||||||||||||||||||||
|
Condition50%1/2
$options{'_expected_method_class'} || 'Moose::Object'
MC/DC0%0/1
$options{'_expected_method_class'} || 'Moose::Object'
$options{'_expected_method_class'}
Truth table50%1/2
A
A= $options{'_expected_method_class'}
| |||||||||||||||||||||||||||||
| 38 | } => $class; | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | # we don't want this creating | ||||||||||||||||||||||||||||
| 41 | # a cycle in the code, if not | ||||||||||||||||||||||||||||
| 42 | # needed | ||||||||||||||||||||||||||||
| 43 | 762 | weaken($self->{'associated_metaclass'}); | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 762 | $self->_initialize_body; | |||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 761 | return $self; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | ## method | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 762 | ▶ | sub _initialize_body { | ||||||||||||||||||||||||||
|
Subroutine
_initialize_body: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 762 | my $self = shift; | |||||||||||||||||||||||||||
| 54 | 762 | $self->{'body'} = $self->_generate_constructor_method_inline; | |||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 388 | 1; | |||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | # ABSTRACT: Method Meta Object for constructors | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | __END__ | ||||||||||||||||||||||||||||