I'm trying to do some persistence, and Data::Dumper seems like a popular tool, so that's what I'm trying to use.

I'm using LWP::Simple to grab web pages, and then I create a hash with a few tidbits about the web page and a copy of the text from the web page. I'd like to stash that hash away somewhere. I've tried playing around with Data::Dumper, but it's giving me a headache.

$hash_ref->{name} = 'a page'; $hash_ref->{time_to_download} = '3.23453'; $hash_ref->{content} = $content; # from LWP::Simple get my $dumped = Dumper($hash_ref); print $a_file $dumped;

I've tried setting Data::Dumper::Pure and Data::Dumper::Terse.

Then there's the problem of eval'ing this thing later. I don't want to eval the entire text of a web page. Maybe the text is 'system("rm -r $HOME")', or however you'd actually format that.

Thanks... gotta run.. another $%^#$^ fire alarm
-Pileofrogs

Update: Thanks! I'll go check out those other modules!

Another Update: YAML looks perfect! I especially like the 'taint safe' aspect.

Final Update: YAML solved my problem. I also used MIME::base64 to encode the content from LWP::Simple before YAML'ing it. That was a big performance boost.


In reply to Data::Dumper for a Dummy by pileofrogs

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.