Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
What kinds of problems are you worried about detecting? I/O errors? Data::Dumper doesn't seem to do any I/O, so you should be fine as long as you are careful to do the error checking yourself when writing to disk (remember that both close and print have return values; see Fatal.pm for a way to reduce the workload a bit).

Storable's man page promises that it checks for I/O errors. I just checked this by creating a small RAM disk and running the following script:

#!/usr/bin/perl use Storable; my @huge = ('aaaaa' .. 'azaaa'); my $result = undef; eval { $result = store \@huge, '/mnt/mfs/bigfile' }; $result = '(undef)' unless defined $result; print "Result:$result exception:$@\n";
Sure enough, this displayed "Result:1" unless the RAM disk filled up, in which cases it displayed "Result:(undef)". (As an aside, the man page says store will die on "serious" errors, but I wasn't able to induce this even by forcibly unmounting the filesystem in mid-write... whatever these serious errors are, I hope I never see one! :)

If you are really paranoid (or running NFS with UDP checksums disabled), you could always try thawing your data back into a second variable and then either doing your own deep comparison or letting Storable do it for you (look for the $Storable::canonical option in the Storable man page).


In reply to Re: verifying serialized objects by saucepan
in thread verifying serialized objects by dshahin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2024-04-23 23:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found