J
J.D. Baldwin
Not sure why Storable's sister functions won't talk each other's
language. Here's a stripped down version of what I have:
#!/bin/perl
use strict;
use warnings;
use Storable qw(store_fd fd_retrieve);
use Data:umper;
my $uploaded_ref;
my $TRACKING_DATA_FILE='tracking.dat'; # Does not exist
my $LIST_FILE='biglist.txt'; # 64,109-line text file,
# one token per line
open my $fd, '>', $TRACKING_DATA_FILE;
open my $list_fd, '<', $LIST_FILE;
while ( <$list_fd> )
{
chomp;
$uploaded_ref->{$_} = 1;
}
store_fd($uploaded_ref, $fd);
close $fd;
open $fd, '>>', $TRACKING_DATA_FILE;
my $new_ref = fd_retrieve($fd);
my $numkeys = keys %{$new_ref};
print "Number: $numkeys\n";
This fails with
Magic number checking on storable file failed at blib/lib/Storable.pm
(autosplit into blib/lib/auto/Storable/fd_retrieve.al) line 398,
<$list_fd> line 64109, at ./init.pl line 27
Any ideas what is going on here? I have to use store_fd and
fd_retrieve because of the kind of locking my project requires.
Storable version is 2.16; Perl is 5.8.8.
language. Here's a stripped down version of what I have:
#!/bin/perl
use strict;
use warnings;
use Storable qw(store_fd fd_retrieve);
use Data:umper;
my $uploaded_ref;
my $TRACKING_DATA_FILE='tracking.dat'; # Does not exist
my $LIST_FILE='biglist.txt'; # 64,109-line text file,
# one token per line
open my $fd, '>', $TRACKING_DATA_FILE;
open my $list_fd, '<', $LIST_FILE;
while ( <$list_fd> )
{
chomp;
$uploaded_ref->{$_} = 1;
}
store_fd($uploaded_ref, $fd);
close $fd;
open $fd, '>>', $TRACKING_DATA_FILE;
my $new_ref = fd_retrieve($fd);
my $numkeys = keys %{$new_ref};
print "Number: $numkeys\n";
This fails with
Magic number checking on storable file failed at blib/lib/Storable.pm
(autosplit into blib/lib/auto/Storable/fd_retrieve.al) line 398,
<$list_fd> line 64109, at ./init.pl line 27
Any ideas what is going on here? I have to use store_fd and
fd_retrieve because of the kind of locking my project requires.
Storable version is 2.16; Perl is 5.8.8.