Storable.pm size limit?

K

KKramsch

I'm running a script that builds a hash over time, and periodically
saves it using Storable. I use a command-line Perl one-liner to
check the number of keys in the hash so far:

perl -MStorable -e '$h = retrieve "mongo"; printf "%d\n", scalar keys %$h'

As of 6 pm last night the one-liner above would print a positive
integer, increasing with every invocation (as expected), but this
morning (the script has been running all night and it's still
running now) the one-liner prints 0. In fact, another one-liner
reveals that the result of the call to retrieve is now undefined.
The file in question is now 33 MB (and growing). Is there a limit
on the size of an object stored with Storable?

I don't understand why the retrieve operation is now failing,
but from looking at the file with a text editor I can see that
there's a *ton* of valuable info in the file that I'd hate to lose.
Is there any way to recover it? Is there a way to truncate the
file to retrieve at least a subset of the keys with their associated
values?

Thanks!

Karl
 
M

Michele Dondi

perl -MStorable -e '$h = retrieve "mongo"; printf "%d\n", scalar keys %$h'

Just a minor side note:

perl -MStorable -e '$h = retrieve "mongo"; print scalar keys %$h'

or even

perl -MStorable -e 'print scalar keys %{retrieve "mongo"}'

the (main) point being that (as 'Perl' neq 'C') most times a simple
print() would do, instead of a prinf().


Michele
 
J

Joe Smith

Michele said:
the (main) point being that (as 'Perl' neq 'C') most times a simple
print() would do, instead of a prinf().

Another handy device is
perl -le '...'
so that the output from print() gets a "\n" appended automatically.
-Joe
 
M

Michele Dondi

Another handy device is
perl -le '...'

In fact you'll notice by peeking at random in some of my posts that I
almost always use it in my example one-liners (and I have the tendency
to adopt it in longer scripts too). Don't really know why didn't use
it here too. Probably because it was slightly less useful than usual,
where I often

print for @somestuff;

since even if it is slightly less efficient it saves me some acrobacy
on the keyboard! ;-)


Michele
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,109
Latest member
JanieMalco
Top