File Coverage

blib/lib/WWW/OpenSearch/Request.pm
Criterion Covered Total %
statement 12 27 44.4
branch 0 2 0.0
condition n/a
subroutine 4 6 66.6
pod 2 2 100.0
total 18 37 48.6


line stmt bran cond sub pod time code
1             package WWW::OpenSearch::Request;
2              
3 2     2   5421 use strict;
  2         5  
  2         97  
4 2     2   20 use warnings;
  2         4  
  2         78  
5              
6 2     2   11 use base qw( HTTP::Request Class::Accessor::Fast );
  2         5  
  2         1173  
7              
8 2     2   75861 use HTTP::Request::Common ();
  2         5214  
  2         545  
9              
10             __PACKAGE__->mk_accessors( qw( opensearch_url opensearch_params ) );
11              
12             =head1 NAME
13              
14             WWW::OpenSearch::Request - Encapsulate an opensearch request
15              
16             =head1 SYNOPSIS
17              
18             =head1 DESCRIPTION
19              
20             =head1 CONSTRUCTOR
21              
22             =head2 new( $url, \%params )
23              
24             =head1 METHODS
25              
26             =head2 clone( )
27              
28             =head1 ACCESSORS
29              
30             =over 4
31              
32             =item * opensearch_url
33              
34             =item * opensearch_params
35              
36             =back
37              
38             =head1 AUTHOR
39              
40             =over 4
41              
42             =item * Brian Cassidy Ebricas@cpan.orgE
43              
44             =back
45              
46             =head1 COPYRIGHT AND LICENSE
47              
48             Copyright 2005-2013 by Tatsuhiko Miyagawa and Brian Cassidy
49              
50             This library is free software; you can redistribute it and/or modify
51             it under the same terms as Perl itself.
52              
53             =cut
54              
55             sub new {
56 0     0 1   my ( $class, $os_url, $params ) = @_;
57              
58 0           my ( $uri, $post ) = $os_url->prepare_query( $params );
59              
60 0           my $self;
61 0 0         if ( lc $os_url->method eq 'post' ) {
62 0           $self = HTTP::Request::Common::POST( $uri, $post );
63 0           bless $self, $class;
64             }
65             else {
66 0           $self = $class->SUPER::new( $os_url->method => $uri );
67             }
68              
69 0           $self->opensearch_url( $os_url );
70 0           $self->opensearch_params( $params );
71              
72 0           return $self;
73             }
74              
75             sub clone {
76 0     0 1   my $self = shift;
77 0           my $clone = bless $self->SUPER::clone, ref( $self );
78              
79 0           $clone->opensearch_url( $self->opensearch_url );
80 0           $clone->opensearch_params( $self->opensearch_params );
81              
82 0           return $clone;
83             }
84              
85             1;