| 1 | package Mouse; | ||||||||||||||||||||||||||||||||||||||
| 2 | 285 | ▶ | use 5.008_005; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||
| 4 | 285 | ▶ | use Mouse::Exporter; # enables strict and warnings | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||
| 6 | 285 | ▶ | use version; our $VERSION = version->declare('v2.6.2'); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||
| 8 | 285 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 9 | 285 | ▶ | use Scalar::Util (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||
| 11 | 285 | ▶ | use Mouse::Util (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||
| 13 | 285 | ▶ | use Mouse::Meta::Module; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 14 | 285 | ▶ | use Mouse::Meta::Class; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 15 | 285 | ▶ | use Mouse::Meta::Role; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 16 | 285 | ▶ | use Mouse::Meta::Attribute; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 17 | 285 | ▶ | use Mouse::Object; | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 18 | 285 | ▶ | use Mouse::Util::TypeConstraints (); | ||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||
| 20 | 121 | Mouse::Exporter->setup_import_methods( | |||||||||||||||||||||||||||||||||||||
| 21 | as_is => [qw( | ||||||||||||||||||||||||||||||||||||||
| 22 | extends with | ||||||||||||||||||||||||||||||||||||||
| 23 | has | ||||||||||||||||||||||||||||||||||||||
| 24 | before after around | ||||||||||||||||||||||||||||||||||||||
| 25 | override super | ||||||||||||||||||||||||||||||||||||||
| 26 | augment inner | ||||||||||||||||||||||||||||||||||||||
| 27 | ), | ||||||||||||||||||||||||||||||||||||||
| 28 | \&Scalar::Util::blessed, | ||||||||||||||||||||||||||||||||||||||
| 29 | \&Carp::confess, | ||||||||||||||||||||||||||||||||||||||
| 30 | ], | ||||||||||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||
| 34 | 120 | ▶ | sub extends { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
extends: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 35 | 120 | Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_); | |||||||||||||||||||||||||||||||||||||
| 36 | 118 | return; | |||||||||||||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||
| 39 | 115 | ▶ | sub with { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
with: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 40 | 115 | Mouse::Util::apply_all_roles(scalar(caller), @_); | |||||||||||||||||||||||||||||||||||||
| 41 | 98 | return; | |||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||
| 44 | 505 | ▶ | sub has { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
has: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 45 | 505 | my $meta = Mouse::Meta::Class->initialize(scalar caller); | |||||||||||||||||||||||||||||||||||||
| 46 | 505 | my $name = shift; | |||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||
| 48 | 505 | ▶ | $meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 49 | if @_ % 2; # odd number of arguments | ||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||
| 51 | 504 | ▶ | for my $n(ref($name) ? @{$name} : $name){ | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 52 | 508 | $meta->add_attribute($n => @_); | |||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||
| 54 | 482 | return; | |||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ▶ | sub before { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
before: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 58 | 9 | my $meta = Mouse::Meta::Class->initialize(scalar caller); | |||||||||||||||||||||||||||||||||||||
| 59 | 9 | my $code = pop; | |||||||||||||||||||||||||||||||||||||
| 60 | 9 | for my $name($meta->_collect_methods(@_)) { | |||||||||||||||||||||||||||||||||||||
| 61 | 10 | $meta->add_before_method_modifier($name => $code); | |||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||
| 63 | 9 | return; | |||||||||||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||||||||||||
| 65 | 286 | ▶ | |||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||
| 66 | 10 | ▶ | sub after { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 67 | 10 | my $meta = Mouse::Meta::Class->initialize(scalar caller); | |||||||||||||||||||||||||||||||||||||
| 68 | 10 | my $code = pop; | |||||||||||||||||||||||||||||||||||||
| 69 | 10 | for my $name($meta->_collect_methods(@_)) { | |||||||||||||||||||||||||||||||||||||
| 70 | 12 | $meta->add_after_method_modifier($name => $code); | |||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||
| 72 | 10 | return; | |||||||||||||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||
| 75 | 16 | ▶ | sub around { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
around: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||
| 76 | 16 | my $meta = Mouse::Meta::Class->initialize(scalar caller); | |||||||||||||||||||||||||||||||||||||
| 77 | 16 | my $code = pop; | |||||||||||||||||||||||||||||||||||||
| 78 | 16 | for my $name($meta->_collect_methods(@_)) { | |||||||||||||||||||||||||||||||||||||
| 79 | 17 | $meta->add_around_method_modifier($name => $code); | |||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||
| 81 | 16 | return; | |||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||
| 84 | 121 | our $SUPER_PACKAGE; | |||||||||||||||||||||||||||||||||||||
| 85 | 121 | our $SUPER_BODY; | |||||||||||||||||||||||||||||||||||||
| 86 | 121 | our @SUPER_ARGS; | |||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||
| 88 | 16 | ▶ | sub super { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
super: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 89 | # This check avoids a recursion loop - see | ||||||||||||||||||||||||||||||||||||||
| 90 | # t/100_bugs/020_super_recursion.t | ||||||||||||||||||||||||||||||||||||||
| 91 | 16 | ▶ | return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $Mouse::SUPER_PACKAGE and $Mouse::SUPER_PACKAGE ne caller()
MC/DC100%2/2
defined $Mouse::SUPER_PACKAGE and $Mouse::SUPER_PACKAGE ne caller()
defined $Mouse::SUPER_PACKAGE
$Mouse::SUPER_PACKAGE ne caller()
Truth table100%3/3
A and B
A= defined $Mouse::SUPER_PACKAGEB= $Mouse::SUPER_PACKAGE ne caller()
| |||||||||||||||||||||||||||||||||||||||
| 92 | 15 | ▶ | return if !defined $SUPER_BODY; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 93 | 14 | $SUPER_BODY->(@SUPER_ARGS); | |||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||
| 96 | 14 | ▶ | sub override { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
override: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 97 | # my($name, $method) = @_; | ||||||||||||||||||||||||||||||||||||||
| 98 | 14 | Mouse::Meta::Class->initialize(scalar caller)->add_override_method_modifier(@_); | |||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||
| 101 | 121 | our %INNER_BODY; | |||||||||||||||||||||||||||||||||||||
| 102 | 121 | our %INNER_ARGS; | |||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||
| 104 | 21 | ▶ | sub inner { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
inner: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 105 | 21 | my $pkg = caller(); | |||||||||||||||||||||||||||||||||||||
| 106 | 21 | ▶ | if ( my $body = $INNER_BODY{$pkg} ) { | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 107 | 12 | my $args = $INNER_ARGS{$pkg}; | |||||||||||||||||||||||||||||||||||||
| 108 | 12 | local $INNER_ARGS{$pkg}; | |||||||||||||||||||||||||||||||||||||
| 109 | 12 | local $INNER_BODY{$pkg}; | |||||||||||||||||||||||||||||||||||||
| 110 | 12 | return $body->(@{$args}); | |||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||
| 112 | else { | ||||||||||||||||||||||||||||||||||||||
| 113 | 9 | return; | |||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||
| 117 | 11 | ▶ | sub augment { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
augment: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 118 | #my($name, $method) = @_; | ||||||||||||||||||||||||||||||||||||||
| 119 | 11 | Mouse::Meta::Class->initialize(scalar caller)->add_augment_method_modifier(@_); | |||||||||||||||||||||||||||||||||||||
| 120 | 10 | return; | |||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||
| 123 | 574 | ▶ | sub init_meta { | ||||||||||||||||||||||||||||||||||||
|
Subroutine
init_meta: called CC=7 SCAR=19.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||
| 124 | 574 | shift; | |||||||||||||||||||||||||||||||||||||
| 125 | 574 | my %args = @_; | |||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||
| 127 | my $class = $args{for_class} | ||||||||||||||||||||||||||||||||||||||
| 128 | 574 | ▶ | or confess("Cannot call init_meta without specifying a for_class"); | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||
| 130 | 574 | ▶ | my $base_class = $args{base_class} || 'Mouse::Object'; | ||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$args{'base_class'} || 'Mouse::Object'
MC/DC100%1/1
$args{'base_class'} || 'Mouse::Object'
$args{'base_class'}
Truth table100%2/2
A
A= $args{'base_class'}
| |||||||||||||||||||||||||||||||||||||||
| 131 | 574 | ▶ | my $metaclass = $args{metaclass} || 'Mouse::Meta::Class'; | ||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$args{'metaclass'} || 'Mouse::Meta::Class'
MC/DC0%0/1
$args{'metaclass'} || 'Mouse::Meta::Class'
$args{'metaclass'}
Truth table50%1/2
A
A= $args{'metaclass'}
| |||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||
| 133 | 574 | my $meta = $metaclass->initialize($class); | |||||||||||||||||||||||||||||||||||||
| 134 | 574 | my $filename = Mouse::Util::module_notional_filename($meta->name); | |||||||||||||||||||||||||||||||||||||
| 135 | $INC{$filename} = '(set by Mouse)' | ||||||||||||||||||||||||||||||||||||||
| 136 | 574 | ▶ | unless exists $INC{$filename}; | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||
| 138 | 85 | ▶ | $meta->add_method(meta => sub{ | ||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
Subroutine
meta: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||||||||||||
| 139 | 85 | ▶ | return $metaclass->initialize(ref($_[0]) || $_[0]); | ||||||||||||||||||||||||||||||||||||
|
Condition66%4/6
ref $_[0] || $_[0]
ref $_[0] || $_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
MC/DC0%0/2
ref $_[0] || $_[0]
ref $_[0]
$_[0]
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
Truth table66%2/3
A || B
A= ref $_[0]B= $_[0]
| |||||||||||||||||||||||||||||||||||||||
| 140 | 574 | }); | |||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||
| 142 | 574 | ▶ | $meta->superclasses($base_class) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 143 | unless $meta->superclasses; | ||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||
| 145 | # make a class type for each Mouse class | ||||||||||||||||||||||||||||||||||||||
| 146 | 574 | ▶ | Mouse::Util::TypeConstraints::class_type($class) | ||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||
| 147 | unless Mouse::Util::TypeConstraints::find_type_constraint($class); | ||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||
| 149 | 574 | return $meta; | |||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||
| 152 | 121 | 1; | |||||||||||||||||||||||||||||||||||||
| 153 | __END__ | ||||||||||||||||||||||||||||||||||||||