DataFlow-Proc-URLRetriever
view release on metacpan or search on metacpan
lib/DataFlow/Proc/URLRetriever.pm view on Meta::CPAN
package DataFlow::Proc::URLRetriever;
use strict;
use warnings;
# ABSTRACT: An URL-retriever processor
our $VERSION = '1.121690'; # VERSION
use Moose;
extends 'DataFlow::Proc';
use namespace::autoclean;
use LWP::UserAgent;
use URI;
has 'ua' => (
'is' => 'ro',
'isa' => 'LWP::UserAgent',
'lazy' => 1,
'default' => sub { LWP::UserAgent->new( $_[0]->ua_options ) }
);
has 'ua_options' => (
'is' => 'ro',
'isa' => 'Any',
);
has 'baseurl' => (
'is' => 'ro',
'isa' => 'Str',
'predicate' => 'has_baseurl',
);
sub _build_p {
my $self = shift;
return sub {
my $url =
$self->has_baseurl
? URI->new_abs( $_, $self->baseurl )->as_string
: $_;
return $self->ua->get($url)->decoded_content;
# TODO allow ArrayRef's instead of Str, and use the other elements
# as parameters for the get() method
};
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding utf-8
=head1 NAME
DataFlow::Proc::URLRetriever - An URL-retriever processor
=head1 VERSION
version 1.121690
=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Perldoc
You can find documentation for this module with the perldoc command.
perldoc DataFlow::Proc::URLRetriever
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
=over 4
=item *
Search CPAN
The default CPAN search engine, useful to view POD in HTML format.
L<http://search.cpan.org/dist/DataFlow-Proc-URLRetriever>
=item *
AnnoCPAN
The AnnoCPAN is a website that allows community annotations of Perl module documentation.
L<http://annocpan.org/dist/DataFlow-Proc-URLRetriever>
=item *
CPAN Ratings
( run in 0.862 second using v1.01-cache-2.11-cpan-39bf76dae61 )