I write a lot of apps that get data from the web. I lot of times I use WWW::Mechanize or just LWP::UserAgent directly. What I want is a cache like most other browsers (user agents) have. A lot of time the content requested is dynamic but most of the time when I am doing some sort of testing (parsing pages) I request the same page several times. I generally use one of two solutions:
(1) use Memoize on request()
(2) write a wrapper that looks in a specified directory for the filename that I am requesting.

Over time I add things like uptodate test (1 line) or a directory size check (2-3) lines. Is there a module out there that already does this, not generally, but specially for LWP? If not, then I am going to write LWP::Cache and would like some advice on what to add, and what to stay away from.

$will->code for @food or $$;


In reply to Wanted: LWP::Cache by smalhotra

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.