Debian Codegraph @

lib/Carp/Fix/1_25.pm

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