| 1 | # this matches, but perlcritic seems to use retarded regexes that don't get this. | ||||||||||||||||||||
| 2 | ## no critic (Modules::RequireFilenameMatchesPackage) | ||||||||||||||||||||
| 3 | package _; | ||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | # PODNAME: _.pm | ||||||||||||||||||||
| 6 | # ABSTRACT: do not use this module directly | ||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 12 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 12 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 12 | ▶ | use Carp (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | my $blow_up = sub { | ||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | # Unload ourselves, so that "require _" gets trapped each time. | ||||||||||||||||||||
| 16 | # However, this is only respected by Perl in the $_WE_COME_IN_PEACE mode. | ||||||||||||||||||||
| 17 | 13 | ▶ | delete $INC{'_.pm'}; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.7
| |||||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | # be silent if this is being loaded by Util::Underscore | ||||||||||||||||||||
| 20 | ## no critic (ProtectPrivateVars) | ||||||||||||||||||||
| 21 | 13 | ▶ | return 1 if ($Util::Underscore::_WE_COME_IN_PEACE // q[]) eq 'pinky swear'; | ||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$Util::Underscore::_WE_COME_IN_PEACE // ""
MC/DC0%0/1
$Util::Underscore::_WE_COME_IN_PEACE // ""
$Util::Underscore::_WE_COME_IN_PEACE
Truth table50%1/2
A
A= $Util::Underscore::_WE_COME_IN_PEACE
| |||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | # loudly complain otherwise. | ||||||||||||||||||||
| 24 | 1 | Carp::confess qq(The "_" package is internal to Util::Underscore) | |||||||||||||||||||
| 25 | . qq(and must not be imported directly.\n); | ||||||||||||||||||||
| 26 | 13 | }; | |||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | { | ||||||||||||||||||||
| 29 | 12 | ▶ | no warnings 'redefine'; ## no critic (ProhibitNoWarnings) | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | sub import { | ||||||||||||||||||||
| 32 | 1 | ▶ | return $blow_up->(); | ||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | |||||||||||||||||||||
| 36 | # End with a true value in the $_WE_COME_IN_PEACE mode, | ||||||||||||||||||||
| 37 | # otherwise use this as a chance to blow up | ||||||||||||||||||||
| 38 | # – "import" has already been compiled after all. | ||||||||||||||||||||
| 39 | ## no critic (Modules::RequireEndWithOne) | ||||||||||||||||||||
| 40 | 13 | $blow_up->(); | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||