root/trunk/plagger/lib/Plagger/UserAgent.pm

Revision 572 (checked in by miyagawa, 14 years ago)

use URI::Fetch 0.06. Fixes #168

  • Property svn:keywords set to Id Revision
Line 
1 package Plagger::UserAgent;
2 use strict;
3 use base qw( LWP::UserAgent );
4
5 use URI::Fetch 0.06;
6
7 sub new {
8     my $class = shift;
9     my $self  = $class->SUPER::new();
10     $self->agent("Plagger/$Plagger::VERSION (http://plagger.bulknews.net/)");
11     $self->timeout(15); # xxx to be config
12     $self;
13 }
14
15 sub fetch {
16     my($self, $url, $plugin) = @_;
17
18     URI::Fetch->fetch($url,
19         UserAgent => $self,
20         $plugin ? (Cache => $plugin->cache) : (),
21         ForceResponse => 1,
22     );
23 }
24
25 1;
26
Note: See TracBrowser for help on using the browser.