| 1 | package autodie; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | 54 | ▶ | use 5.008; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 3 | 54 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 54 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 54 | ▶ | use parent qw(Fatal); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 53 | our $VERSION; | |||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | # ABSTRACT: Replace functions with ones that succeed or die with lexical scope | ||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||
| 11 | 54 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | 54 | our $VERSION = '2.37'; # VERSION: Generated by DZP::OurPkg::Version | |||||||||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 54 | ▶ | use constant ERROR_WRONG_FATAL => q{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | Incorrect version of Fatal.pm loaded by autodie. | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | The autodie pragma uses an updated version of Fatal to do its | ||||||||||||||||||||||||||||||||||||||||||
| 19 | heavy lifting. We seem to have loaded Fatal version %s, which is | ||||||||||||||||||||||||||||||||||||||||||
| 20 | probably the version that came with your version of Perl. However | ||||||||||||||||||||||||||||||||||||||||||
| 21 | autodie needs version %s, which would have come bundled with | ||||||||||||||||||||||||||||||||||||||||||
| 22 | autodie. | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | You may be able to solve this problem by adding the following | ||||||||||||||||||||||||||||||||||||||||||
| 25 | line of code to your main program, before any use of Fatal or | ||||||||||||||||||||||||||||||||||||||||||
| 26 | autodie. | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | use lib "%s"; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 54 | }; | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # We have to check we've got the right version of Fatal before we | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # try to compile the rest of our code, lest we use a constant | ||||||||||||||||||||||||||||||||||||||||||
| 34 | # that doesn't exist. | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 54 | ▶ | BEGIN { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=4 SCAR=22.3
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | # If we have the wrong Fatal, then we've probably loaded the system | ||||||||||||||||||||||||||||||||||||||||||
| 39 | # one, not our own. Complain, and give a useful hint. ;) | ||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 54 | ▶ | if (defined($Fatal::VERSION) and defined($VERSION) and $Fatal::VERSION ne $VERSION) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $Fatal::VERSION and defined $autodie::VERSION and $Fatal::VERSION ne $autodie::VERSION
defined $Fatal::VERSION and defined $autodie::VERSION
MC/DC0%0/3
defined $Fatal::VERSION and defined $autodie::VERSION and $Fatal::VERSION ne $autodie::VERSION
defined $Fatal::VERSION
defined $autodie::VERSION
$Fatal::VERSION ne $autodie::VERSION
Truth table25%1/4
A and B and C
A= defined $Fatal::VERSIONB= defined $autodie::VERSIONC= $Fatal::VERSION ne $autodie::VERSION
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | my $autodie_path = $INC{'autodie.pm'}; | |||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | $autodie_path =~ s/autodie\.pm//; | |||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | require Carp; | |||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | Carp::croak sprintf( | |||||||||||||||||||||||||||||||||||||||||
| 49 | ERROR_WRONG_FATAL, $Fatal::VERSION, $VERSION, $autodie_path | ||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | # When passing args to Fatal we want to keep the first arg | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # (our package) in place. Hence the splice. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 130 | ▶ | sub import { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
import: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 130 | splice(@_,1,0,Fatal::LEXICAL_TAG); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 130 | goto &Fatal::import; | |||||||||||||||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 12 | ▶ | sub unimport { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
unimport: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 12 | splice(@_,1,0,Fatal::LEXICAL_TAG); | |||||||||||||||||||||||||||||||||||||||||
| 64 | 12 | goto &Fatal::unimport; | |||||||||||||||||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 53 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | __END__ | ||||||||||||||||||||||||||||||||||||||||||