File Coverage

blib/lib/WWW/Google/CustomSearch/Request.pm
Criterion Covered Total %
statement 14 19 73.6
branch n/a
condition n/a
subroutine 5 7 71.4
pod 1 2 50.0
total 20 28 71.4


line stmt bran cond sub pod time code
1             package WWW::Google::CustomSearch::Request;
2              
3             $WWW::Google::CustomSearch::Request::VERSION = '0.39';
4             $WWW::Google::CustomSearch::Request::AUTHORITY = 'cpan:MANWAR';
5              
6             =head1 NAME
7              
8             WWW::Google::CustomSearch::Request - Placeholder for Google JSON/Atom Custom Search Request.
9              
10             =head1 VERSION
11              
12             Version 0.39
13              
14             =cut
15              
16 5     5   94 use 5.006;
  5         19  
17 5     5   28 use Data::Dumper;
  5         10  
  5         237  
18 5     5   30 use WWW::Google::CustomSearch::Page;
  5         10  
  5         94  
19              
20 5     5   24 use Moo;
  5         10  
  5         27  
21 5     5   1688 use namespace::autoclean;
  5         19  
  5         31  
22              
23             has 'page' => (is => 'ro');
24             has 'api_key' => (is => 'ro', required => 1);
25              
26             sub BUILD {
27 0     0 0   my ($self, $args) = @_;
28              
29 0           $args->{'api_key'} = $self->api_key;
30 0           $self->{page} = WWW::Google::CustomSearch::Page->new($args);
31             }
32              
33             =head1 DESCRIPTION
34              
35             Provides the interface to the search request used last time.
36              
37             =head1 METHOD
38              
39             =head2 fetch()
40              
41             Returns the L object base on the criteria used in the last
42             search.
43              
44             use strict; use warnings;
45             use WWW::Google::CustomSearch;
46              
47             my $api_key = 'Your_API_Key';
48             my $cx = 'Search_Engine_Identifier';
49             my $engine = WWW::Google::CustomSearch->new(api_key => $api_key, cx => $cx);
50             my $result = $engine->search("Google");
51             my $page = $result->request;
52             my $another = $page->fetch;
53              
54             =cut
55              
56             sub fetch {
57 0     0 1   my ($self) = @_;
58              
59 0           return $self->{page}->fetch;
60             }
61              
62             =head1 AUTHOR
63              
64             Mohammad S Anwar, C<< >>
65              
66             =head1 REPOSITORY
67              
68             L
69              
70             =head1 CONTRIBUTORS
71              
72             David Kitcher-Jones (m4ddav3)
73              
74             =head1 BUGS
75              
76             Please report any bugs or feature requests to C
77             rt.cpan.org>, or through the web interface at L.
78             I will be notified, and then you'll automatically be notified of progress on your
79             bug as I make changes.
80              
81             =head1 SUPPORT
82              
83             You can find documentation for this module with the perldoc command.
84              
85             perldoc WWW::Google::CustomSearch::Request
86              
87             You can also look for information at:
88              
89             =over 4
90              
91             =item * RT: CPAN's request tracker (report bugs here)
92              
93             L
94              
95             =item * AnnoCPAN: Annotated CPAN documentation
96              
97             L
98              
99             =item * CPAN Ratings
100              
101             L
102              
103             =item * Search CPAN
104              
105             L
106              
107             =back
108              
109             =head1 LICENSE AND COPYRIGHT
110              
111             Copyright (C) 2011 - 2015 Mohammad S Anwar.
112              
113             This program is free software; you can redistribute it and / or modify it under
114             the terms of the the Artistic License (2.0). You may obtain a copy of the full
115             license at:
116              
117             L
118              
119             Any use, modification, and distribution of the Standard or Modified Versions is
120             governed by this Artistic License.By using, modifying or distributing the Package,
121             you accept this license. Do not use, modify, or distribute the Package, if you do
122             not accept this license.
123              
124             If your Modified Version has been derived from a Modified Version made by someone
125             other than you,you are nevertheless required to ensure that your Modified Version
126             complies with the requirements of this license.
127              
128             This license does not grant you the right to use any trademark, service mark,
129             tradename, or logo of the Copyright Holder.
130              
131             This license includes the non-exclusive, worldwide, free-of-charge patent license
132             to make, have made, use, offer to sell, sell, import and otherwise transfer the
133             Package with respect to any patent claims licensable by the Copyright Holder that
134             are necessarily infringed by the Package. If you institute patent litigation
135             (including a cross-claim or counterclaim) against any party alleging that the
136             Package constitutes direct or contributory patent infringement,then this Artistic
137             License to you shall terminate on the date that such litigation is filed.
138              
139             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
140             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
141             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
142             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
143             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
144             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
145             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
146              
147             =cut
148              
149             1; # End of WWW::Google::CustomSearch::Request