blob: b33b1578222e85bb7223af0ae3eb3448e4e902a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
package MooseX::UserAgent::Paranoid;
use Moose::Role;
with qw/
MooseX::UserAgent::Config
MooseX::UserAgent::Content
MooseX::UserAgent::Cache
MooseX::UserAgent::Generic
/;
has _LWPLIB => ( isa => 'Str', is => 'ro', default => 'LWPx::ParanoidAgent' );
1;
__END__
=head1 NAME
RTGI::Role::UserAgent::Paranoid - Fetch an url using LWPx::ParanoidAgent
=head1 SYNOPSIS
package Foo;
use Moose;
with qw/MooseX::UserAgent::Paranoid/;
has useragent_conf => (
isa => 'HashRef',
default => sub {
{ name => 'myownbot', };
}
);
my $res = $self->fetch($url, $cache);
...
my $content = $self->get_content($res);
=head1 DESCRIPTION
=head2 METHODS
=over 4
=item B<fetch>
This method will fetch a given URL. This method handle only the http
protocol.
If there is a cache configuration, the url will be checked in the cache,
and if there is a match, a 304 HTTP code will be returned.
Return a HTTP::Response object.
=back
=head1 BUGS AND LIMITATIONS
=head1 AUTHOR
franck cuny C<< <franck.cuny@rtgi.fr> >>
=head1 LICENCE AND COPYRIGHT
Copyright (c) 2009, RTGI
All rights reserved.
L<http://rtgi.fr/>
This module is free software; you can redistribute it and/or
modify it under the same terms as Perl itself. See L<perlartistic>.
|