logo       

Re: RFC HTTP::Cache module: msg#00051

lang.perl.modules.lwp

Subject: Re: RFC HTTP::Cache module

>>>>> "Mattias" == Mattias Holmlund <u1@xxxxxxxxxxxxxx> writes:

Mattias> I have written a perl module that I want to publish on
Mattias> CPAN. The module implements a cache for http requests.

The module that I've designed a half dozen times in my head but never
implemented would simply overload LWP::UserAgent's "simple_request"
method with one that did caching transparently.

Maybe if you thought about this enough, you could do that. Then I
wouldn't have to finish writing the module that's in my head.

The advantage this has is that you could take *any* application that
ultimately uses LWP::UserAgent (and they pretty much all do, great job
Gisle!), and then mixin your module, and you'd get caching for free.
Such as:

## you add:
use LWP::UserAgent::TransparentCache qw(cache => parameters);
## to this:
use LWP::Simple;
my $content = get("foo");

and it's done. Or anything more complex. And it'd still work.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@xxxxxxxxxxxxxx> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise