line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WWW::OpenSearch::Agent; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
95
|
|
4
|
3
|
|
|
3
|
|
16
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
102
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
15
|
use base qw( LWP::UserAgent ); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
5621
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
220296
|
use WWW::OpenSearch; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
50
|
|
9
|
3
|
|
|
3
|
|
2289
|
use WWW::OpenSearch::Response; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
WWW::OpenSearch::Agent - An agent for doing OpenSearch requests |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 new( [%options] ) |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 METHODS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head2 request( $request | $url, \%params ) |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 search( ) |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
An alias for request() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 AUTHOR |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=over 4 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item * Brian Cassidy Ebricas@cpan.orgE |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=back |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Copyright 2005-2013 by Tatsuhiko Miyagawa and Brian Cassidy |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
44
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
|
|
|
|
|
|
my ( $class, @rest ) = @_; |
50
|
|
|
|
|
|
|
return $class->SUPER::new( |
51
|
|
|
|
|
|
|
agent => join( '/', __PACKAGE__, $WWW::OpenSearch::VERSION ), |
52
|
|
|
|
|
|
|
@rest, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
*search = \&request; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub request { |
59
|
|
|
|
|
|
|
my $self = shift; |
60
|
|
|
|
|
|
|
my $request = shift; |
61
|
|
|
|
|
|
|
my $response = $self->SUPER::request( $request, @_ ); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# allow regular HTTP::Requests to flow through |
64
|
|
|
|
|
|
|
return $response unless $request->isa( 'WWW::OpenSearch::Request' ); |
65
|
|
|
|
|
|
|
return WWW::OpenSearch::Response->new( $response ); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |