| 1 | package Mouse::Util; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 287 | ▶ | use Mouse::Exporter; # enables strict and warnings | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | # Note that those which don't exist here are defined in XS or Mouse::PurePerl | ||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # must be here because it will be referred by other modules loaded | ||||||||||||||||||||||||||||||||||||||||||||||
| 7 | sub get_linear_isa($;$); ## no critic | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # must be here because it will called in Mouse::Exporter | ||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 304 | ▶ | sub install_subroutines { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
install_subroutines: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 304 | my $into = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 304 | ▶ | while(my($name, $code) = splice @_, 0, 2){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 287 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 287 | ▶ | no warnings 'once', 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 287 | ▶ | use warnings FATAL => 'uninitialized'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 1207 | *{$into . '::' . $name} = \&{$code}; | |||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 304 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 287 | ▶ | BEGIN{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=8 SCAR=21.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | # This is used in Mouse::PurePerl | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 287 | Mouse::Exporter->setup_import_methods( | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | as_is => [qw( | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | find_meta | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | does_role | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | resolve_metaclass_alias | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | apply_all_roles | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | english_list | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | load_class | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | is_class_loaded | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | get_linear_isa | ||||||||||||||||||||||||||||||||||||||||||||||
| 36 | get_code_info | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | get_code_package | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | get_code_ref | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | not_supported | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | does meta throw_error dump | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | )], | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | groups => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | default => [], # export no functions by default | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | # The ':meta' group is 'use metaclass' for Mouse | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | meta => [qw(does meta dump throw_error)], | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 287 | ▶ | use version; our $VERSION = version->declare('v2.6.2'); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 287 | ▶ | my $xs = !(defined(&is_valid_class_name) || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY}); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
defined &Mouse::Util::is_valid_class_name || $ENV{'MOUSE_PUREPERL'} || $ENV{'PERL_ONLY'}
defined &Mouse::Util::is_valid_class_name or $ENV{"MOUSE_PUREPERL"}
MC/DC33%1/3
defined &Mouse::Util::is_valid_class_name || $ENV{'MOUSE_PUREPERL'} || $ENV{'PERL_ONLY'}
defined &Mouse::Util::is_valid_class_name
$ENV{"MOUSE_PUREPERL"}
$ENV{'PERL_ONLY'}
Truth table50%2/4
A or B || C
A= defined &Mouse::Util::is_valid_class_nameB= $ENV{"MOUSE_PUREPERL"}C= $ENV{'PERL_ONLY'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | # Because Mouse::Util is loaded first in all the Mouse sub-modules, | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | # XSLoader must be placed here, not in Mouse.pm. | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 287 | ▶ | if($xs){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | # XXX: XSLoader tries to get the object path from caller's file name | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | # $hack_mouse_file fools its mechanism | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 286 | (my $hack_mouse_file = __FILE__) =~ s/.Util//; # .../Mouse/Util.pm -> .../Mouse.pm | |||||||||||||||||||||||||||||||||||||||||||||
| 63 | 286 | ▶ | $xs = eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . q{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . "\n local \$^W = 0; # workaround 'redefine' warning to &install_subroutines\n no warnings 'redefine';\n require XSLoader;\n XSLoader::load('Mouse', \$VERSION);\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta');\n return 1;\n " || 0
MC/DC0%0/1
eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . "\n local \$^W = 0; # workaround 'redefine' warning to &install_subroutines\n no warnings 'redefine';\n require XSLoader;\n XSLoader::load('Mouse', \$VERSION);\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta');\n return 1;\n " || 0
eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . "\n local \$^W = 0; # workaround 'redefine' warning to &install_subroutines\n no warnings 'redefine';\n require XSLoader;\n XSLoader::load('Mouse', \$VERSION);\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta');\n return 1;\n "
Truth table50%1/2
A
A= eval sprintf("#line %d %s\n", __LINE__, $hack_mouse_file) . "\n local \$^W = 0; # workaround 'redefine' warning to &install_subroutines\n no warnings 'redefine';\n require XSLoader;\n XSLoader::load('Mouse', \$VERSION);\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta');\n Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta');\n return 1;\n "
| |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | local $^W = 0; # workaround 'redefine' warning to &install_subroutines | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | no warnings 'redefine'; | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | require XSLoader; | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | XSLoader::load('Mouse', $VERSION); | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | Mouse::Util->import({ into => 'Mouse::Meta::Method::Constructor::XS' }, ':meta'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 69 | Mouse::Util->import({ into => 'Mouse::Meta::Method::Destructor::XS' }, ':meta'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | Mouse::Util->import({ into => 'Mouse::Meta::Method::Accessor::XS' }, ':meta'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | return 1; | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | } || 0; | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 286 | ▶ | warn $@ if $@ && $ENV{MOUSE_XS}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$@ and $ENV{"MOUSE_XS"}
MC/DC0%0/2
$@ and $ENV{"MOUSE_XS"}
$@
$ENV{"MOUSE_XS"}
Truth table33%1/3
A and B
A= $@B= $ENV{"MOUSE_XS"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 287 | ▶ | if(!$xs){ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | require 'Mouse/PurePerl.pm'; # we don't want to create its namespace | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 287 | my $value = $xs; # avoid "Constants from lexical variables potentially modified elsewhere are deprecated" | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | *MOUSE_XS = sub(){ $value }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # definition of mro::get_linear_isa() | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 287 | my $get_linear_isa; | |||||||||||||||||||||||||||||||||||||||||||||
| 87 | 287 | require 'mro.pm'; | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | 287 | $get_linear_isa = \&mro::get_linear_isa; | |||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 287 | *get_linear_isa = $get_linear_isa; | |||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 287 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 94 | 287 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||||
| 96 | # aliases as public APIs | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # it must be 'require', not 'use', because Mouse::Meta::Module depends on Mouse::Util | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 287 | require Mouse::Meta::Module; # for the entities of metaclass cache utilities | |||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||
| 100 | # aliases | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 287 | *class_of = \&Mouse::Meta::Module::_class_of; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | 287 | *get_metaclass_by_name = \&Mouse::Meta::Module::_get_metaclass_by_name; | |||||||||||||||||||||||||||||||||||||||||||||
| 104 | 287 | *get_all_metaclass_instances = \&Mouse::Meta::Module::_get_all_metaclass_instances; | |||||||||||||||||||||||||||||||||||||||||||||
| 105 | 287 | *get_all_metaclass_names = \&Mouse::Meta::Module::_get_all_metaclass_names; | |||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 287 | *Mouse::load_class = \&load_class; | |||||||||||||||||||||||||||||||||||||||||||||
| 108 | 287 | *Mouse::is_class_loaded = \&is_class_loaded; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # is-a predicates | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | #generate_isa_predicate_for('Mouse::Meta::TypeConstraint' => 'is_a_type_constraint'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | #generate_isa_predicate_for('Mouse::Meta::Class' => 'is_a_metaclass'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | #generate_isa_predicate_for('Mouse::Meta::Role' => 'is_a_metarole'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||
| 115 | # duck type predicates | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 287 | generate_can_predicate_for(['_compiled_type_constraint'] => 'is_a_type_constraint'); | |||||||||||||||||||||||||||||||||||||||||||||
| 117 | 287 | generate_can_predicate_for(['create_anon_class'] => 'is_a_metaclass'); | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | 287 | generate_can_predicate_for(['create_anon_role'] => 'is_a_metarole'); | |||||||||||||||||||||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||
| 121 | sub in_global_destruction; | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 287 | ▶ | if (defined ${^GLOBAL_PHASE}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 103 | ▶ | *in_global_destruction = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 103 | return ${^GLOBAL_PHASE} eq 'DESTRUCT'; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 287 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 128 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | my $in_global_destruction = 0; | |||||||||||||||||||||||||||||||||||||||||||||
| 130 | 287 | ▶ | END { $in_global_destruction = 1 } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | ▶ | *in_global_destruction = sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | return $in_global_destruction; | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | }; | |||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | # Moose::Util compatible utilities | ||||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 12 | ▶ | sub find_meta{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_meta: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 12 | return class_of( $_[0] ); | |||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 178 | ▶ | sub _does_role_impl { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_does_role_impl: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 178 | my ($class_or_obj, $role_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 178 | my $meta = class_of($class_or_obj); | |||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 178 | ▶ | (defined $role_name) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$meta || 'Mouse::Meta::Class'
MC/DC0%0/1
$meta || 'Mouse::Meta::Class'
$meta
Truth table50%1/2
A
A= $meta
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | || ($meta || 'Mouse::Meta::Class')->throw_error("You must supply a role name to does()"); | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 177 | ▶ | return defined($meta) && $meta->does_role($role_name); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
defined $meta && $meta->does_role($role_name)
MC/DC100%2/2
defined $meta && $meta->does_role($role_name)
defined $meta
$meta->does_role($role_name)
Truth table100%3/3
A && B
A= defined $metaB= $meta->does_role($role_name)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 54 | ▶ | sub does_role { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
does_role: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 54 | my($thing, $role_name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 54 | ▶ | if( (Scalar::Util::blessed($thing) || is_class_loaded($thing)) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%6/6
builtin::blessed($thing) || is_class_loaded($thing) and $thing->can("does")
builtin::blessed($thing) or is_class_loaded($thing)
MC/DC100%3/3
builtin::blessed($thing) || is_class_loaded($thing) and $thing->can("does")
builtin::blessed($thing)
is_class_loaded($thing)
$thing->can("does")
Truth table80%4/5
A or B and C
A= builtin::blessed($thing)B= is_class_loaded($thing)C= $thing->can("does")
| |||||||||||||||||||||||||||||||||||||||||||||||
| 157 | && $thing->can('does')) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 49 | return $thing->does($role_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 5 | goto &_does_role_impl; | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | # taken from Mouse::Util (0.90) | ||||||||||||||||||||||||||||||||||||||||||||||
| 164 | { | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 287 | my %cache; | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 40 | ▶ | sub resolve_metaclass_alias { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resolve_metaclass_alias: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 168 | 40 | my ( $type, $metaclass_name, %options ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 40 | ▶ | my $cache_key = $type . q{ } . ( $options{trait} ? '-Trait' : '' ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 40 | ▶ | return $cache{$cache_key}{$metaclass_name} ||= do{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$cache{$cache_key}{$metaclass_name} ||= do {
my $possible_full_name = join("::", "Mouse::Meta", $type, "Custom", $options{"trait"} ? "Trait" : (), $metaclass_name);
my $loaded_class = load_first_existing_class($possible_full_name, $metaclass_name);
$loaded_class->can("register_implementation") ? $loaded_class->register_implementation : $loaded_class
}
MC/DC0%0/2
$cache{$cache_key}{$metaclass_name} ||= do {
my $possible_full_name = join("::", "Mouse::Meta", $type, "Custom", $options{"trait"} ? "Trait" : (), $metaclass_name);
my $loaded_class = load_first_existing_class($possible_full_name, $metaclass_name);
$loaded_class->can("register_implementation") ? $loaded_class->register_implementation : $loaded_class
}
$cache{$cache_key}{$metaclass_name}
do {
my $possible_full_name = join("::", "Mouse::Meta", $type, "Custom", $options{"trait"} ? "Trait" : (), $metaclass_name);
my $loaded_class = load_first_existing_class($possible_full_name, $metaclass_name);
$loaded_class->can("register_implementation") ? $loaded_class->register_implementation : $loaded_class
}
Truth table66%2/3
A ||= B
A= $cache{$cache_key}{$metaclass_name}B= do {
my $possible_full_name = join("::", "Mouse::Meta", $type, "Custom", $options{"trait"} ? "Trait" : (), $metaclass_name);
my $loaded_class = load_first_existing_class($possible_full_name, $metaclass_name);
$loaded_class->can("register_implementation") ? $loaded_class->register_implementation : $loaded_class
}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | my $possible_full_name = join '::', | ||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 31 | ▶ | 'Mouse::Meta', $type, 'Custom', ($options{trait} ? 'Trait' : ()), $metaclass_name | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 176 | ; | ||||||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 31 | my $loaded_class = load_first_existing_class( | |||||||||||||||||||||||||||||||||||||||||||||
| 179 | $possible_full_name, | ||||||||||||||||||||||||||||||||||||||||||||||
| 180 | $metaclass_name | ||||||||||||||||||||||||||||||||||||||||||||||
| 181 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 31 | ▶ | $loaded_class->can('register_implementation') | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 184 | ? $loaded_class->register_implementation | ||||||||||||||||||||||||||||||||||||||||||||||
| 185 | : $loaded_class; | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||
| 190 | # Taken from Module::Runtime | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 287 | ▶ | sub module_notional_filename { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_notional_filename: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | 820 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||||||
| 194 | 820 | $class =~ s{::}{/}g; | |||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 820 | return $class.'.pm'; | |||||||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||
| 199 | # Utilities from Class::MOP | ||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | sub get_code_info; | ||||||||||||||||||||||||||||||||||||||||||||||
| 202 | sub get_code_package; | ||||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||||
| 204 | sub is_valid_class_name; | ||||||||||||||||||||||||||||||||||||||||||||||
| 205 | sub is_class_loaded; | ||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||
| 207 | # taken from Class/MOP.pm | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | 31 | ▶ | sub load_first_existing_class { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_first_existing_class: called CC=4 SCAR=14.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 31 | ▶ | my @classes = @_ | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 210 | or return; | ||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||
| 212 | 31 | my %exceptions; | |||||||||||||||||||||||||||||||||||||||||||||
| 213 | 31 | for my $class (@classes) { | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | 52 | my $e = _try_load_one_class($class); | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 52 | ▶ | if ($e) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 21 | $exceptions{$class} = $e; | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 219 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | 31 | return $class; | |||||||||||||||||||||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||||
| 224 | # not found | ||||||||||||||||||||||||||||||||||||||||||||||
| 225 | Carp::confess join( | ||||||||||||||||||||||||||||||||||||||||||||||
| 226 | "\n", | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | map { | ||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | sprintf( "Could not load class (%s) because : %s", | |||||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | $_, $exceptions{$_} ) | |||||||||||||||||||||||||||||||||||||||||||||
| 230 | } @classes | ||||||||||||||||||||||||||||||||||||||||||||||
| 231 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # taken from Class/MOP.pm | ||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1333 | ▶ | sub _try_load_one_class { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_try_load_one_class: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1333 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1333 | ▶ | unless ( is_valid_class_name($class) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 5 | ▶ | my $display = defined($class) ? $class : 'undef'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 240 | 5 | Carp::confess "Invalid class name ($display)"; | |||||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1328 | ▶ | return '' if is_class_loaded($class); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 46 | my $filename = module_notional_filename($class); | |||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||||
| 247 | 46 | return do { | |||||||||||||||||||||||||||||||||||||||||||||
| 248 | 46 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | 46 | eval { require $filename }; | |||||||||||||||||||||||||||||||||||||||||||||
| 250 | 46 | $@; | |||||||||||||||||||||||||||||||||||||||||||||
| 251 | }; | ||||||||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 1281 | ▶ | sub load_class { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
load_class: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 256 | 1281 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | 1281 | my $e = _try_load_one_class($class); | |||||||||||||||||||||||||||||||||||||||||||||
| 258 | 1276 | ▶ | Carp::confess "Could not load class ($class) because : $e" if $e; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 1272 | return $class; | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||||||||||||||||||||
| 264 | 220 | ▶ | sub apply_all_roles { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_all_roles: called CC=9 SCAR=22.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 220 | ▶ | my $consumer = Scalar::Util::blessed($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 266 | ? $_[0] # instance | ||||||||||||||||||||||||||||||||||||||||||||||
| 267 | : Mouse::Meta::Class->initialize($_[0]); # class or role name | ||||||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||||||
| 269 | 220 | my @roles; | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||
| 271 | # Basis of Data::OptList | ||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 220 | my $max = scalar(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 273 | 220 | ▶ | for (my $i = 1; $i < $max ; $i++) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 285 | my $role = $_[$i]; | |||||||||||||||||||||||||||||||||||||||||||||
| 275 | 285 | my $role_name; | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | 285 | ▶ | if(ref $role) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 4 | $role_name = $role->name; | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 279 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 281 | $role_name = $role; | |||||||||||||||||||||||||||||||||||||||||||||
| 281 | 281 | load_class($role_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 282 | 281 | $role = get_metaclass_by_name($role_name); | |||||||||||||||||||||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 285 | ▶ | if ($i + 1 < $max && ref($_[$i + 1]) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$i + 1 < $max and ref $_[$i + 1] eq "HASH"
MC/DC100%2/2
$i + 1 < $max and ref $_[$i + 1] eq "HASH"
$i + 1 < $max
ref $_[$i + 1] eq "HASH"
Truth table100%3/3
A and B
A= $i + 1 < $maxB= ref $_[$i + 1] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 35 | push @roles, [ $role => $_[++$i] ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 287 | } else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 288 | 250 | push @roles, [ $role => undef ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 289 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 285 | ▶ | is_a_metarole($role) | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 291 | || $consumer->meta->throw_error("You can only consume roles, $role_name is not a Mouse role"); | ||||||||||||||||||||||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 219 | ▶ | if ( scalar @roles == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 295 | 167 | my ( $role, $params ) = @{ $roles[0] }; | |||||||||||||||||||||||||||||||||||||||||||||
| 296 | 167 | ▶ | $role->apply( $consumer, defined $params ? $params : () ); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 298 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 52 | Mouse::Meta::Role->combine(@roles)->apply($consumer); | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 199 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # taken from Moose::Util 0.90 | ||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 19 | ▶ | sub english_list { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
english_list: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 19 | ▶ | return $_[0] if @_ == 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 10 | my @items = sort @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 10 | ▶ | return "$items[0] and $items[1]" if @items == 2; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||||||
| 312 | 2 | my $tail = pop @items; | |||||||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | return join q{, }, @items, "and $tail"; | |||||||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 18 | ▶ | sub quoted_english_list { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
quoted_english_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 18 | return english_list(map { qq{'$_'} } @_); | |||||||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||||||
| 321 | # common utilities | ||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 1 | ▶ | sub not_supported{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
not_supported: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 1 | my($feature) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 1 | ▶ | $feature ||= ( caller(1) )[3] . '()'; # subroutine name | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$feature ||= (caller 1)[3] . '()'
MC/DC0%0/1
$feature ||= (caller 1)[3] . '()'
$feature
Truth table50%1/2
A
A= $feature
| |||||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 1 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 329 | 1 | Carp::confess("Mouse does not currently support $feature"); | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||||
| 332 | # general meta() method | ||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 116 | ▶ | sub meta :method{ | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
meta: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 116 | ▶ | return Mouse::Meta::Class->initialize(ref($_[0]) || $_[0]); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||
| 337 | # general throw_error() method | ||||||||||||||||||||||||||||||||||||||||||||||
| 338 | # $o->throw_error($msg, depth => $leve, longmess => $croak_or_confess) | ||||||||||||||||||||||||||||||||||||||||||||||
| 339 | 981 | ▶ | sub throw_error :method { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throw_error: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 981 | my($self, $message, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 981 | ▶ | local $Carp::CarpLevel = $Carp::CarpLevel + 1 + ($args{depth} || 0); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'depth'} || 0
MC/DC100%1/1
$args{'depth'} || 0
$args{'depth'}
Truth table100%2/2
A
A= $args{'depth'}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 981 | local $Carp::MaxArgNums = 20; # default is 8, usually we use named args which gets messier though | |||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 981 | ▶ | if(exists $args{longmess} && !$args{longmess}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
exists $args{"longmess"} and not $args{"longmess"}
MC/DC0%0/2
exists $args{"longmess"} and not $args{"longmess"}
exists $args{"longmess"}
not $args{"longmess"}
Truth table33%1/3
A and not(B)
A= exists $args{"longmess"}B= not $args{"longmess"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | Carp::croak($message); | |||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 348 | else{ | ||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 981 | Carp::confess($message); | |||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||
| 353 | # general dump() method | ||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | ▶ | sub dump :method { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | my($self, $maxdepth) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | require 'Data/Dumper.pm'; # we don't want to create its namespace | |||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | my $dd = Data::Dumper->new([$self]); | |||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | $dd->Maxdepth(defined($maxdepth) ? $maxdepth : 3); | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $dd->Indent(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $dd->Sortkeys(1); | |||||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | $dd->Quotekeys(0); | |||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return $dd->Dump(); | |||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||||||
| 366 | # general does() method | ||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 173 | ▶ | sub does :method { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
does: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 368 | 173 | goto &_does_role_impl; | |||||||||||||||||||||||||||||||||||||||||||||
| 369 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 370 | |||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 287 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 372 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||