XML-FeedLite
view release on metacpan or search on metacpan
lib/XML/FeedLite.pm view on Meta::CPAN
my ($self, $url_ref, $headers) = @_;
my $ua = WWW::Curl::Simple->new;
$self->{'statuscodes'} = {};
if(!$headers) {
$headers = {};
}
if($ENV{HTTP_X_FORWARDED_FOR}) {
$headers->{'X-Forwarded-For'} ||= $ENV{'HTTP_X_FORWARDED_FOR'};
}
for my $url (keys %{$url_ref}) {
if(ref $url_ref->{$url} ne 'CODE') {
$DEBUG and print {*STDERR} qq[handler for $url isn't CODE];
next;
}
$DEBUG and print {*STDERR} qq(Building HTTP::Request for $url [timeout=$self->{'timeout'}] via $url_ref->{$url}\n);
my $http_headers = HTTP::Headers->new(%{$headers});
lib/XML/FeedLite.pm view on Meta::CPAN
#########
# URLs and associated callbacks
#
'url1' => sub { ... },
'url2' => sub { ... },
},
{
#########
# Optional HTTP headers
#
'X-Forwarded-For' => 'a.b.c.d',
});
=head2 statuscodes - Retrieve HTTP status codes for request URLs
my $code = $xfl->statuscodes($url);
my $code_hashref = $xfl->statuscodes();
=head2 max_req - set number of running concurrent requests
$xfl->max_req(5);
( run in 0.525 second using v1.01-cache-2.11-cpan-26ccb49234f )