use strict;
use warnings;
use Storable qw/nstore/;
my $rep = bless { phrase => 'All your base belong to us' }, 'SomeClass';
my $file = 'my_file_name';
eval { nstore($rep, $file) || warn "Storable::nstore failed with $!\n"; };
if ($@) { warn "Failed to store the object: $@\n"; }
####
if ($path =~ m/\.gz$/) { $fh = new IO::Zlib }
else { $fh = new IO::File }
$ctx->throw('Abuse.open',
"Problem opening Abuse report: $!")
unless $fh->open($path, "r");
$rep = fd_retrieve($fh);
close $fh;
##
##
my $fh = IO::File->new("gunzip $file |");
##
##
$ find /usr/lib/perl* -type f -name Zlib.pm -o -name Storable.pm | xargs egrep -i '\$version = '
/usr/lib/perl5/5.8.5/i386-linux-thread-multi/Storable.pm:$VERSION = '2.15';
/usr/lib/perl5/5.8.5/Memoize/Storable.pm:$VERSION = 0.65;
/usr/lib/perl5/site_perl/5.8.5/IO/Zlib.pm:$VERSION = "1.04";
/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi/Compress/Zlib.pm:$VERSION = "1.41" ;
##
##
sub AUTOLOAD
{
my $self = shift;
$AUTOLOAD =~ s/.*:://;
$AUTOLOAD =~ tr/a-z/A-Z/;
return tied(*{$self})->$AUTOLOAD(@_); # line 566
}
##
##
sub fd_retrieve {
my ($file) = @_;
my $fd = fileno($file); # <== THIS IS THE CALL
logcroak "not a valid file descriptor" unless defined $fd;
my $self;
my $da = $@; # Could be from exception handler
eval { $self = pretrieve($file) }; # Call C routine
logcroak $@ if $@ =~ s/\.?\n$/,/;
$@ = $da;
return $self;
}
##
##
$ctx->throw('Abuse.open',
"Problem opening Abuse report: $!")
unless $fh->open($path, ($path =~ /\.gz$/? "<:gzip" : "<"));