|
Re: RFC HTTP::Cache module: msg#00052lang.perl.modules.lwp
On tor, 2004-09-30 at 14:30, Randal L. Schwartz wrote: > 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. > Ok, I'll give it a shot. I experimented with how to overload simple_request and came up with the following. Does it seem right so far? use strict; use LWP::UserAgent; BEGIN { print "Installing\n"; $LWP::Simple::FULL_LWP++; my $org_simple_request = \&LWP::UserAgent::simple_request; { no warnings; *LWP::UserAgent::simple_request = sub { my($self, $request, $arg, $size) = @_; print "Overloaded\n"; return &$org_simple_request( $self, $request, $arg, $size ); } } } 1; /Mattias |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: RFC HTTP::Cache module: 00052, Randal L. Schwartz |
|---|---|
| Previous by Thread: | Re: RFC HTTP::Cache modulei: 00052, Randal L. Schwartz |
| Next by Thread: | Re: <script><script> bug in HTML::TokeParser?: 00052, Ed Avis |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |