| 1 | package Mouse::Exporter; | ||||||||||||||||||||||||||||
| 2 | 287 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 287 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 287 | ▶ | use Carp (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 287 | my %SPEC; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | # it must be "require", because Mouse::Util depends on Mouse::Exporter, | ||||||||||||||||||||||||||||
| 9 | # which depends on Mouse::Util::import() | ||||||||||||||||||||||||||||
| 10 | 287 | require Mouse::Util; | |||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 983 | ▶ | sub import{ | ||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 983 | strict->import; | |||||||||||||||||||||||||||
| 14 | 983 | warnings->import('all', FATAL => 'recursion'); | |||||||||||||||||||||||||||
| 15 | 983 | return; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 984 | ▶ | sub setup_import_methods{ | ||||||||||||||||||||||||||
|
Subroutine
setup_import_methods: called CC=2 SCAR=7.9
Pod
documented
| |||||||||||||||||||||||||||||
| 20 | 984 | my($class, %args) = @_; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 984 | ▶ | my $exporting_package = $args{exporting_package} ||= caller(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{"exporting_package"} ||= caller()
MC/DC0%0/2
$args{"exporting_package"} ||= caller()
$args{"exporting_package"}
caller()
Truth table33%1/3
A ||= B
A= $args{"exporting_package"}B= caller()
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 984 | my($import, $unimport) = $class->build_import_methods(%args); | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | Mouse::Util::install_subroutines($exporting_package, | ||||||||||||||||||||||||||||
| 27 | import => $import, | ||||||||||||||||||||||||||||
| 28 | unimport => $unimport, | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | export_to_level => sub { | ||||||||||||||||||||||||||
|
Subroutine
export_to_level: not called CC=1 SCAR=1.2
Subroutine
__ANON__: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 31 | 0 | my($package, $level, undef, @args) = @_; # the third argument is redundant | |||||||||||||||||||||||||||
| 32 | 0 | $package->import({ into_level => $level + 1 }, @args); | |||||||||||||||||||||||||||
| 33 | }, | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | export => sub { | ||||||||||||||||||||||||||
|
Subroutine
export: not called CC=1 SCAR=1.2
Subroutine
__ANON__: called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 35 | 0 | my($package, $into, @args) = @_; | |||||||||||||||||||||||||||
| 36 | 0 | $package->import({ into => $into }, @args); | |||||||||||||||||||||||||||
| 37 | }, | ||||||||||||||||||||||||||||
| 38 | 984 | ); | |||||||||||||||||||||||||||
| 39 | 984 | return; | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 984 | ▶ | sub build_import_methods{ | ||||||||||||||||||||||||||
|
Subroutine
build_import_methods: called CC=20 SCAR=30.2
Pod
documented
| |||||||||||||||||||||||||||||
| 43 | 984 | my($self, %args) = @_; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 984 | ▶ | my $exporting_package = $args{exporting_package} ||= caller(); | ||||||||||||||||||||||||||
|
Condition33%1/3
$args{"exporting_package"} ||= caller()
MC/DC0%0/2
$args{"exporting_package"} ||= caller()
$args{"exporting_package"}
caller()
Truth table33%1/3
A ||= B
A= $args{"exporting_package"}B= caller()
| |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 984 | $SPEC{$exporting_package} = \%args; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # canonicalize args | ||||||||||||||||||||||||||||
| 50 | 984 | my @export_from; | |||||||||||||||||||||||||||
| 51 | 984 | ▶ | if($args{also}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 52 | 7 | my %seen; | |||||||||||||||||||||||||||
| 53 | 7 | my @stack = ($exporting_package); | |||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 7 | ▶ | while(my $current = shift @stack){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 56 | 15 | push @export_from, $current; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 15 | ▶ | my $also = $SPEC{$current}{also} or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 59 | 8 | ▶ | push @stack, grep{ !$seen{$_}++ } ref($also) ? @{ $also } : $also; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | else{ | ||||||||||||||||||||||||||||
| 63 | 977 | @export_from = ($exporting_package); | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 984 | my %exports; | |||||||||||||||||||||||||||
| 67 | my @removables; | ||||||||||||||||||||||||||||
| 68 | 984 | my @all; | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 984 | my @init_meta_methods; | |||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 984 | foreach my $package(@export_from){ | |||||||||||||||||||||||||||
| 73 | 992 | ▶ | my $spec = $SPEC{$package} or next; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 992 | ▶ | if(my $as_is = $spec->{as_is}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 987 | foreach my $thingy (@{$as_is}){ | |||||||||||||||||||||||||||
| 77 | 14068 | my($code_package, $code_name, $code); | |||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 14068 | ▶ | if(ref($thingy)){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 80 | 769 | $code = $thingy; | |||||||||||||||||||||||||||
| 81 | 769 | ($code_package, $code_name) = Mouse::Util::get_code_info($code); | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | else{ | ||||||||||||||||||||||||||||
| 84 | 13299 | $code_package = $package; | |||||||||||||||||||||||||||
| 85 | 13299 | $code_name = $thingy; | |||||||||||||||||||||||||||
| 86 | 287 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 87 | 13299 | $code = \&{ $code_package . '::' . $code_name }; | |||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 14068 | push @all, $code_name; | |||||||||||||||||||||||||||
| 91 | 14068 | $exports{$code_name} = $code; | |||||||||||||||||||||||||||
| 92 | 14068 | ▶ | if($code_package eq $package){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 93 | 13300 | push @removables, $code_name; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 992 | ▶ | if(my $init_meta = $package->can('init_meta')){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 99 | 387 | ▶ | if(!grep{ $_ == $init_meta } @init_meta_methods){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 387 | push @init_meta_methods, $init_meta; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 984 | $args{EXPORTS} = \%exports; | |||||||||||||||||||||||||||
| 105 | 984 | $args{REMOVABLES} = \@removables; | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 984 | ▶ | $args{groups}{all} ||= \@all; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"groups"}{"all"} ||= \@all
MC/DC0%0/1
$args{"groups"}{"all"} ||= \@all
$args{"groups"}{"all"}
Truth table50%1/2
A
A= $args{"groups"}{"all"}
| |||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||
| 109 | 984 | ▶ | if(my $default_list = $args{groups}{default}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 287 | my %default; | |||||||||||||||||||||||||||
| 111 | 287 | foreach my $keyword(@{$default_list}){ | |||||||||||||||||||||||||||
| 112 | 0 | ▶ | $default{$keyword} = $exports{$keyword} | ||||||||||||||||||||||||||
|
Condition0%0/2
$exports{$keyword} || Carp::confess(qq[The $exporting_package package does not export "$keyword"])
MC/DC0%0/1
$exports{$keyword} || Carp::confess(qq[The $exporting_package package does not export "$keyword"])
$exports{$keyword}
Truth table0%0/2
A
A= $exports{$keyword}
| |||||||||||||||||||||||||||||
| 113 | || Carp::confess(qq{The $exporting_package package does not export "$keyword"}); | ||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||
| 115 | 287 | $args{DEFAULT} = \%default; | |||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||
| 117 | else{ | ||||||||||||||||||||||||||||
| 118 | 697 | ▶ | $args{groups}{default} ||= \@all; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args{"groups"}{"default"} ||= \@all
MC/DC0%0/1
$args{"groups"}{"default"} ||= \@all
$args{"groups"}{"default"}
Truth table50%1/2
A
A= $args{"groups"}{"default"}
| |||||||||||||||||||||||||||||
| 119 | 697 | $args{DEFAULT} = $args{EXPORTS}; | |||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | 984 | ▶ | if(@init_meta_methods){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | 384 | $args{INIT_META} = \@init_meta_methods; | |||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 984 | return (\&do_import, \&do_unimport); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||
| 129 | # the entity of general import() | ||||||||||||||||||||||||||||
| 130 | 4209 | ▶ | sub do_import { | ||||||||||||||||||||||||||
|
Subroutine
do_import: called CC=18 SCAR=29.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 131 | 4209 | my($package, @args) = @_; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 4209 | ▶ | my $spec = $SPEC{$package} | ||||||||||||||||||||||||||
|
Condition50%1/2
$SPEC{$package} || Carp::confess("The package $package package does not use Mouse::Exporter")
MC/DC0%0/1
$SPEC{$package} || Carp::confess("The package $package package does not use Mouse::Exporter")
$SPEC{$package}
Truth table50%1/2
A
A= $SPEC{$package}
| |||||||||||||||||||||||||||||
| 134 | || Carp::confess("The package $package package does not use Mouse::Exporter"); | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 4209 | ▶ | my $into = _get_caller_package(ref($args[0]) ? shift @args : undef); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | 4209 | my @exports; | |||||||||||||||||||||||||||
| 139 | my @traits; | ||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 4209 | ▶ | while(@args){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 3426 | my $arg = shift @args; | |||||||||||||||||||||||||||
| 143 | 3426 | ▶ | if($arg =~ s/^-//){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 144 | 17 | ▶ | if($arg eq 'traits'){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 17 | ▶ | push @traits, ref($args[0]) ? @{shift(@args)} : shift(@args); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||
| 147 | else { | ||||||||||||||||||||||||||||
| 148 | 0 | Mouse::Util::not_supported("-$arg"); | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | elsif($arg =~ s/^://){ | ||||||||||||||||||||||||||||
| 152 | 2493 | ▶ | my $group = $spec->{groups}{$arg} | ||||||||||||||||||||||||||
|
Condition50%1/2
$spec->{'groups'}{$arg} || Carp::confess(qq[The $package package does not export the group "$arg"])
MC/DC0%0/1
$spec->{'groups'}{$arg} || Carp::confess(qq[The $package package does not export the group "$arg"])
$spec->{'groups'}{$arg}
Truth table50%1/2
A
A= $spec->{'groups'}{$arg}
| |||||||||||||||||||||||||||||
| 153 | || Carp::confess(qq{The $package package does not export the group "$arg"}); | ||||||||||||||||||||||||||||
| 154 | 2493 | push @exports, @{$group}; | |||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||
| 156 | else{ | ||||||||||||||||||||||||||||
| 157 | 916 | push @exports, $arg; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||
| 161 | 4209 | strict->import; | |||||||||||||||||||||||||||
| 162 | 4209 | warnings->import('all', FATAL => 'recursion'); | |||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | 4209 | ▶ | if($spec->{INIT_META}){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 165 | 766 | my $meta; | |||||||||||||||||||||||||||
| 166 | 766 | foreach my $init_meta(@{$spec->{INIT_META}}){ | |||||||||||||||||||||||||||
| 167 | 771 | $meta = $package->$init_meta(for_class => $into); | |||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||
| 170 | 766 | ▶ | if(@traits){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 16 | my $type = (split /::/, ref $meta)[-1]; # e.g. "Class" for "My::Meta::Class" | |||||||||||||||||||||||||||
| 172 | @traits = map{ | ||||||||||||||||||||||||||||
| 173 | 16 | ▶ | ref($_) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 174 | ? $_ | ||||||||||||||||||||||||||||
| 175 | : Mouse::Util::resolve_metaclass_alias($type => $_, trait => 1) | ||||||||||||||||||||||||||||
| 176 | } @traits; | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 16 | require Mouse::Util::MetaRole; | |||||||||||||||||||||||||||
| 179 | 16 | ▶ | Mouse::Util::MetaRole::apply_metaroles( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 180 | for => $into, | ||||||||||||||||||||||||||||
| 181 | Mouse::Util::is_a_metarole($into->meta) | ||||||||||||||||||||||||||||
| 182 | ? (role_metaroles => { role => \@traits }) | ||||||||||||||||||||||||||||
| 183 | : (class_metaroles => { class => \@traits }), | ||||||||||||||||||||||||||||
| 184 | ); | ||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||
| 187 | elsif(@traits){ | ||||||||||||||||||||||||||||
| 188 | 1 | Carp::confess("Cannot provide traits when $package does not have an init_meta() method"); | |||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 4208 | ▶ | if(@exports){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 2813 | my @export_table; | |||||||||||||||||||||||||||
| 193 | 2813 | foreach my $keyword(@exports){ | |||||||||||||||||||||||||||
| 194 | push @export_table, | ||||||||||||||||||||||||||||
| 195 | 10900 | ▶ | $keyword => ($spec->{EXPORTS}{$keyword} | ||||||||||||||||||||||||||
|
Condition50%1/2
$spec->{'EXPORTS'}{$keyword} || Carp::confess(qq[The $package package does not export "$keyword"])
MC/DC0%0/1
$spec->{'EXPORTS'}{$keyword} || Carp::confess(qq[The $package package does not export "$keyword"])
$spec->{'EXPORTS'}{$keyword}
Truth table50%1/2
A
A= $spec->{'EXPORTS'}{$keyword}
| |||||||||||||||||||||||||||||
| 196 | || Carp::confess(qq{The $package package does not export "$keyword"}) | ||||||||||||||||||||||||||||
| 197 | ); | ||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||
| 199 | 2813 | Mouse::Util::install_subroutines($into, @export_table); | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | else{ | ||||||||||||||||||||||||||||
| 202 | 1395 | Mouse::Util::install_subroutines($into, %{$spec->{DEFAULT}}); | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | 4208 | return; | |||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||
| 207 | # the entity of general unimport() | ||||||||||||||||||||||||||||
| 208 | 62 | ▶ | sub do_unimport { | ||||||||||||||||||||||||||
|
Subroutine
do_unimport: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 209 | 62 | my($package, $arg) = @_; | |||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | 62 | ▶ | my $spec = $SPEC{$package} | ||||||||||||||||||||||||||
|
Condition50%1/2
$SPEC{$package} || Carp::confess("The package $package does not use Mouse::Exporter")
MC/DC0%0/1
$SPEC{$package} || Carp::confess("The package $package does not use Mouse::Exporter")
$SPEC{$package}
Truth table50%1/2
A
A= $SPEC{$package}
| |||||||||||||||||||||||||||||
| 212 | || Carp::confess("The package $package does not use Mouse::Exporter"); | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 62 | my $from = _get_caller_package($arg); | |||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||
| 216 | 62 | my $stash = do{ | |||||||||||||||||||||||||||
| 217 | 287 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 218 | 62 | \%{$from . '::'} | |||||||||||||||||||||||||||
| 219 | }; | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | 62 | for my $keyword (@{ $spec->{REMOVABLES} }) { | |||||||||||||||||||||||||||
| 222 | 673 | ▶ | next if !exists $stash->{$keyword}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 223 | 665 | my $gv = \$stash->{$keyword}; | |||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||
| 225 | # remove what is from us | ||||||||||||||||||||||||||||
| 226 | 665 | ▶ | if(ref($gv) eq 'GLOB' && *{$gv}{CODE} == $spec->{EXPORTS}{$keyword}){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $gv eq "GLOB" and *{$gv;}{"CODE"} == $spec->{"EXPORTS"}{$keyword}
MC/DC50%1/2
ref $gv eq "GLOB" and *{$gv;}{"CODE"} == $spec->{"EXPORTS"}{$keyword}
ref $gv eq "GLOB"
*{$gv;}{"CODE"} == $spec->{"EXPORTS"}{$keyword}
Truth table66%2/3
A and B
A= ref $gv eq "GLOB"B= *{$gv;}{"CODE"} == $spec->{"EXPORTS"}{$keyword}
| |||||||||||||||||||||||||||||
| 227 | 664 | delete $stash->{$keyword}; | |||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | 62 | return; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | 4271 | ▶ | sub _get_caller_package { | ||||||||||||||||||||||||||
|
Subroutine
_get_caller_package: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 234 | 4271 | my($arg) = @_; | |||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # We need one extra level because it's called by import so there's a layer | ||||||||||||||||||||||||||||
| 237 | # of indirection | ||||||||||||||||||||||||||||
| 238 | 4271 | ▶ | if(ref $arg){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | return defined($arg->{into}) ? $arg->{into} | ||||||||||||||||||||||||||||
| 240 | : defined($arg->{into_level}) ? scalar caller(1 + $arg->{into_level}) | ||||||||||||||||||||||||||||
| 241 | 861 | ▶ | : scalar caller(1); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | else{ | ||||||||||||||||||||||||||||
| 244 | 3410 | return scalar caller(1); | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 287 | 1; | |||||||||||||||||||||||||||
| 249 | __END__ | ||||||||||||||||||||||||||||