/usr/share/perl5/Carp/Fix/1_25.pm is in libcarp-fix-1-25-perl 1.000001-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | package Carp::Fix::1_25;
# Smooth over the formatting change to Carp messages in Carp 1.25.
use strict;
use warnings;
use 5.008;
our $VERSION = '1.000001';
require Carp;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT = qw(confess carp croak);
our @EXPORT_OK = qw(cluck verbose longmess shortmess);
our @EXPORT_FAIL = qw(verbose);
*verbose = \&Carp::verbose;
# Pass through to Carp 1.25 or higher, it works
if( $Carp::VERSION && $Carp::VERSION >= 1.25 ) {
*carp = \&Carp::carp;
*croak = \&Carp::croak;
*cluck = \&Carp::cluck;
*confess = \&Carp::confess;
*longmess = \&Carp::longmess;
*shortmess = \&Carp::shortmess;
}
# Bypass to our fixes.
else {
*carp = \&Carp::Fix::1_25::Fixed::carp;
*croak = \&Carp::Fix::1_25::Fixed::croak;
*cluck = \&Carp::Fix::1_25::Fixed::cluck;
*confess = \&Carp::Fix::1_25::Fixed::confess;
*longmess = \&Carp::Fix::1_25::Fixed::longmess;
*shortmess = \&Carp::Fix::1_25::Fixed::shortmess;
}
package Carp::Fix::1_25::Fixed;
# Tell Carp not to report our wrappers.
$Carp::Internal{"Carp::Fix::1_25::Fixed"}++;
# Put in the dot
sub _fix_carp_msg {
${$_[0]} =~ s{at (.*?) line (\d+)\n}{at $1 line $2.\n}g;
return;
}
sub shortmess {
my $msg = Carp::shortmess(@_);
_fix_carp_msg(\$msg);
return $msg;
}
sub longmess {
my $msg = Carp::longmess(@_);
_fix_carp_msg(\$msg);
return $msg;
}
sub carp {
return warn shortmess(@_);
}
sub croak {
return die shortmess(@_);
}
sub cluck {
return warn longmess(@_);
}
sub confess {
return die longmess(@_);
}
1;
__END__
=head1 NAME
Carp::Fix::1_25 - Smooth over incompatible changes in Carp 1.25
=head1 SYNOPSIS
use Carp::Fix::1_25;
carp "This will have a period at the end, like die";
croak "No matter what version of Carp you have installed";
=head1 DESCRIPTION
Carp 1.25 made a change to its formatting, adding a period at the end
of the message. This can mess up tests and code that are looking for
error messages. Carp::Fix::1_25 makes the message consistent,
regardless of what versoin of Carp you're using.
Carp::Fix::1_25 exports its own carp functions which change the Carp
message to match the 1.25 version. Carp::Fix::1_25 otherwise acts
exactly like Carp and it will honor L<Carp global
variables|Carp/GLOBAL VARIABLES> such as C<@CARP_NOT> and
C<%Carp::Internal>.
Why do this instead of just upgrading Carp? Upgrading Carp would
affect all installed code all at once. You might not be ready for
that, or you might not want your module to foist that on its users.
This lets you fix things one namespace at a time.
=head1 KNOWN BUGS
The Carp which comes with 5.6.x does not have the necessary features
to support this wrapper.
=head1 COPYRIGHT
Copyright 2012 by Michael G Schwern E<lt>schwernE<0x40>pobox.comE<gt>.
This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
See L<http://dev.perl.org/licenses/artistic.html>
=head1 BUGS, ISSUES and FEEDBACK
Please report and bugs, issues, feedback, annoyances or kudos to
L<http://github.com/schwern/Carp-Fix-1_25/issues>. Don't worry if you
don't have a fix. Don't worry if you don't have all the information.
Don't worry if you don't know if it's a bug. We want to hear from you.
Report early, report often.
Source code repository at L<http://github.com/schwern/Carp-Fix-1_25/>
=head1 SEE ALSO
L<Carp>
|