| 1 | package Moose::Exception::InvalidArgPassedToMooseUtilMetaRole; | ||||||||||||||||||||||||||||||||
| 2 | 2 | our $VERSION = '2.4001'; | |||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use Moose; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 2 | extends 'Moose::Exception'; | |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 2 | has 'argument' => ( | |||||||||||||||||||||||||||||||
| 8 | is => 'ro', | ||||||||||||||||||||||||||||||||
| 9 | isa => 'Any', | ||||||||||||||||||||||||||||||||
| 10 | required => 1 | ||||||||||||||||||||||||||||||||
| 11 | ); | ||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||
| 13 | 6 | ▶ | sub _build_message { | ||||||||||||||||||||||||||||||
|
Subroutine
_build_message: called CC=6 SCAR=18.1
| |||||||||||||||||||||||||||||||||
| 14 | 6 | my $self = shift; | |||||||||||||||||||||||||||||||
| 15 | 6 | my $error = 'When using Moose::Util::MetaRole, you must pass a Moose class name,' | |||||||||||||||||||||||||||||||
| 16 | . ' role name, metaclass object, or metarole object.'; | ||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||
| 18 | 6 | my $arg = $self->argument; | |||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | my $found = blessed $arg ? $arg : Class::MOP::class_of($arg); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | 6 | my $error2; | |||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||
| 23 | 6 | ▶ | if ( defined $found && blessed $found ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
defined $found and builtin::blessed($found)
MC/DC50%1/2
defined $found and builtin::blessed($found)
defined $found
builtin::blessed($found)
Truth table66%2/3
A and B
A= defined $foundB= builtin::blessed($found)
| |||||||||||||||||||||||||||||||||
| 24 | 3 | $error2 = " You passed ".$arg.", and we resolved this to a " | |||||||||||||||||||||||||||||||
| 25 | . ( blessed $found ) | ||||||||||||||||||||||||||||||||
| 26 | . ' object.'; | ||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||
| 28 | elsif ( !defined $found ) { | ||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | $error2 = " You passed ".( defined $arg ? $arg : "undef" ).", and this did not resolve to a metaclass or metarole." | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 30 | . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?'; | ||||||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||||||
| 32 | else { | ||||||||||||||||||||||||||||||||
| 33 | 0 | $error2 = " You passed an undef." | |||||||||||||||||||||||||||||||
| 34 | . ' Maybe you need to call Moose->init_meta to initialize the metaclass first?'; | ||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||
| 37 | 6 | $error.$error2; | |||||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||
| 41 | 2 | 1; | |||||||||||||||||||||||||||||||