Skip to content

Commit

Permalink
Make Storable load even with %INC modified
Browse files Browse the repository at this point in the history
Modified to stop Log::Agent from loading, that is.

There’s at least one CPAN module that does it.  While that module
could be blamed, Storable used to be more robust in this area
before the AutoLoader extirpation, and there is nothing wrong with
robustness.
  • Loading branch information
Father Chrysostomos committed Nov 3, 2011
1 parent d5d5f91 commit 24d967e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 5 additions & 4 deletions Storable.pm
Expand Up @@ -21,7 +21,7 @@ package Storable; @ISA = qw(Exporter);

use vars qw($canonical $forgive_me $VERSION);

$VERSION = '2.32';
$VERSION = '2.33';

BEGIN {
if (eval { local $SIG{__DIE__}; require Log::Agent; 1 }) {
Expand All @@ -31,13 +31,14 @@ BEGIN {
# Use of Log::Agent is optional. If it hasn't imported these subs then
# provide a fallback implementation.
#
else {
if (!exists &logcroak) {
require Carp;

*logcroak = sub {
Carp::croak(@_);
};

}
if (!exists &logcarp) {
require Carp;
*logcarp = sub {
Carp::carp(@_);
};
Expand Down
12 changes: 12 additions & 0 deletions t/robust.t
@@ -0,0 +1,12 @@
#!/usr/bin/perl

# This test script checks that Storable will load properly if someone
# is incorrectly messing with %INC to hide Log::Agent. No, no-one should
# really be doing this, but, then, it *used* to work!

use Test::More;
plan tests => 1;

$INC{'Log/Agent.pm'} = '#ignore#';
require Storable;
pass;

0 comments on commit 24d967e

Please sign in to comment.