File Coverage

lib/DataFlow/Proc/URLRetriever.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package DataFlow::Proc::URLRetriever;
2              
3 1     1   41367 use strict;
  1         2  
  1         35  
4 1     1   5 use warnings;
  1         3  
  1         58  
5              
6             # ABSTRACT: An URL-retriever processor
7              
8             our $VERSION = '1.121690'; # VERSION
9              
10 1     1   455 use Moose;
  0            
  0            
11             extends 'DataFlow::Proc';
12              
13             use namespace::autoclean;
14             use LWP::UserAgent;
15             use URI;
16              
17             has 'ua' => (
18             'is' => 'ro',
19             'isa' => 'LWP::UserAgent',
20             'lazy' => 1,
21             'default' => sub { LWP::UserAgent->new( $_[0]->ua_options ) }
22             );
23              
24             has 'ua_options' => (
25             'is' => 'ro',
26             'isa' => 'Any',
27             );
28              
29             has 'baseurl' => (
30             'is' => 'ro',
31             'isa' => 'Str',
32             'predicate' => 'has_baseurl',
33             );
34              
35             sub _build_p {
36             my $self = shift;
37              
38             return sub {
39             my $url =
40             $self->has_baseurl
41             ? URI->new_abs( $_, $self->baseurl )->as_string
42             : $_;
43              
44             return $self->ua->get($url)->decoded_content;
45              
46             # TODO allow ArrayRef's instead of Str, and use the other elements
47             # as parameters for the get() method
48             };
49             }
50              
51             __PACKAGE__->meta->make_immutable;
52              
53             1;
54              
55             __END__
56             =pod
57              
58             =encoding utf-8
59              
60             =head1 NAME
61              
62             DataFlow::Proc::URLRetriever - An URL-retriever processor
63              
64             =head1 VERSION
65              
66             version 1.121690
67              
68             =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
69              
70             =head1 SUPPORT
71              
72             =head2 Perldoc
73              
74             You can find documentation for this module with the perldoc command.
75              
76             perldoc DataFlow::Proc::URLRetriever
77              
78             =head2 Websites
79              
80             The following websites have more information about this module, and may be of help to you. As always,
81             in addition to those websites please use your favorite search engine to discover more resources.
82              
83             =over 4
84              
85             =item *
86              
87             Search CPAN
88              
89             The default CPAN search engine, useful to view POD in HTML format.
90              
91             L<http://search.cpan.org/dist/DataFlow-Proc-URLRetriever>
92              
93             =item *
94              
95             AnnoCPAN
96              
97             The AnnoCPAN is a website that allows community annotations of Perl module documentation.
98              
99             L<http://annocpan.org/dist/DataFlow-Proc-URLRetriever>
100              
101             =item *
102              
103             CPAN Ratings
104              
105             The CPAN Ratings is a website that allows community ratings and reviews of Perl modules.
106              
107             L<http://cpanratings.perl.org/d/DataFlow-Proc-URLRetriever>
108              
109             =item *
110              
111             CPAN Forum
112              
113             The CPAN Forum is a web forum for discussing Perl modules.
114              
115             L<http://cpanforum.com/dist/DataFlow-Proc-URLRetriever>
116              
117             =item *
118              
119             CPANTS
120              
121             The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
122              
123             L<http://cpants.perl.org/dist/overview/DataFlow-Proc-URLRetriever>
124              
125             =item *
126              
127             CPAN Testers
128              
129             The CPAN Testers is a network of smokers who run automated tests on uploaded CPAN distributions.
130              
131             L<http://www.cpantesters.org/distro/D/DataFlow-Proc-URLRetriever>
132              
133             =item *
134              
135             CPAN Testers Matrix
136              
137             The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
138              
139             L<http://matrix.cpantesters.org/?dist=DataFlow-Proc-URLRetriever>
140              
141             =back
142              
143             =head2 Email
144              
145             You can email the author of this module at C<RUSSOZ at cpan.org> asking for help with any problems you have.
146              
147             =head2 Internet Relay Chat
148              
149             You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is,
150             please read this excellent guide: L<http://en.wikipedia.org/wiki/Internet_Relay_Chat>. Please
151             be courteous and patient when talking to us, as we might be busy or sleeping! You can join
152             those networks/channels and get help:
153              
154             =over 4
155              
156             =item *
157              
158             irc.perl.org
159              
160             You can connect to the server at 'irc.perl.org' and join this channel: #sao-paulo.pm then talk to this person for help: russoz.
161              
162             =back
163              
164             =head2 Bugs / Feature Requests
165              
166             Please report any bugs or feature requests by email to C<bug-dataflow-proc-urlretriever at rt.cpan.org>, or through
167             the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=DataFlow-Proc-URLRetriever>. You will be automatically notified of any
168             progress on the request by the system.
169              
170             =head2 Source Code
171              
172             The code is open to the world, and available for you to hack on. Please feel free to browse it and play
173             with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
174             from your repository :)
175              
176             L<https://github.com/russoz/DataFlow-Proc-URLRetriever>
177              
178             git clone https://github.com/russoz/DataFlow-Proc-URLRetriever.git
179              
180             =head1 AUTHOR
181              
182             Alexei Znamensky <russoz@cpan.org>
183              
184             =head1 COPYRIGHT AND LICENSE
185              
186             This software is copyright (c) 2011 by Alexei Znamensky.
187              
188             This is free software; you can redistribute it and/or modify it under
189             the same terms as the Perl 5 programming language system itself.
190              
191             =head1 BUGS AND LIMITATIONS
192              
193             You can make new bug reports, and view existing ones, through the
194             web interface at L<http://rt.cpan.org>.
195              
196             =head1 DISCLAIMER OF WARRANTY
197              
198             BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
199             FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT
200             WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER
201             PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND,
202             EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
203             IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
204             PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
205             SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME
206             THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
207              
208             IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
209             WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
210             REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE
211             TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR
212             CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
213             SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
214             RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
215             FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
216             SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
217             DAMAGES.
218              
219             =cut
220