NAME
XML::FeedLite - Perl extension for fetching Atom and RSS feeds with minimal outlay
VERSION
$Revision: 1.9 $
SYNOPSIS
use XML::FeedLite;
DESCRIPTION
This module fetches and processes Atom and RSS-format XML feeds. It's designed as an alternative to XML::Atom, specifically to work better under mod_perl. This module requires LWP::Parallel::UserAgent.
SUBROUTINES/METHODS
new - Constructor
my $xfl = XML::FeedLite->new('http://www.atomenabled.org/atom.xml');
my $xfl = XML::FeedLite->new([qw(http://www.atomenabled.org/atom.xml
http://slashdot.org/slashdot.rss)]);
my $xfl = XML::FeedLite->new({
timeout => 60,
url => 'http://www.atomenabled.org/atom.xml',
http_proxy => 'http://user:pass@webcache.local.com:3128/',
});
Options can be: url (optional scalar or array ref, URLs of feeds)
timeout (optional int, HTTP fetch timeout in seconds)
http_proxy (optional scalar, web cache or proxy if not set in %ENV)
proxy_user (optional scalar, username for authenticating forward-proxy)
proxy_pass (optional scalar, password for authenticating forward-proxy)
user_agent (optional scalar, User-Agent HTTP request header value)
Very often you'll want to use XML:::FeedLite::Normalised instead of this baseclass.
http_proxy - Get/Set http_proxy
$xfl->http_proxy("http://user:pass@squid.myco.com:3128/");
proxy_user - Get/Set proxy username for authenticating forward-proxies
This is only required if the username wasn't specified when setting http_proxy
$xfl->proxy_user('myusername');
proxy_pass - Get/Set proxy password for authenticating forward-proxies
This is only required if the password wasn't specified when setting http_proxy
$xfl->proxy_pass('secretpassword');
user_agent - Get/Set user-agent for request headers
$xfl->user_agent('Feedtastic/1.0');
timeout - Get/Set timeout
$xfl->timeout(30);
url - Get/Set DSN
$xfl->url('http://das.ensembl.org/das/ensembl1834/'); # give url (scalar or arrayref) here if not specified in new()
Or, if you want to add to the existing url list and you're feeling sneaky...
push @{$xfl->url}, 'http://my.server/das/additionalsource';
reset - Flush bufers, reset flags etc.
$xfl->reset();
entries - Retrieve XML::Simple data structures from feeds
my $entry_data = $xfl->entries();
meta - Meta data globally keyed on feed, or for a given feed
my $hrMeta = $xfl->meta();
my $hrFeedMeta = $xfl->meta('http://mysite.com/feed.xml');
title - The name/title of a given feed
my $title = $xfl->title($feed);
fetch - Performs the HTTP fetch and processing
$xfl->fetch({
#########
# URLs and associated callbacks
#
'url1' => sub { ... },
'url2' => sub { ... },
},
{
#########
# Optional HTTP headers
#
'X-Forwarded-For' => 'a.b.c.d',
});
statuscodes - Retrieve HTTP status codes for request URLs
my $code = $xfl->statuscodes($url);
my $code_hashref = $xfl->statuscodes();
max_req - set number of running concurrent requests
$xfl->max_req(5);
print $xfl->max_req();
DIAGNOSTICS
CONFIGURATION AND ENVIRONMENT
DEPENDENCIES
- strict
- warnings
- WWW::Curl::Simple
- HTTP::Request
- HTTP::Headers
- HTML::Entities
- MIME::Base64
- English
- Carp
- Readonly
INCOMPATIBILITIES
BUGS AND LIMITATIONS
AUTHOR
Roger Pettett, <rmp@psyphi.net>
LICENSE AND COPYRIGHT
Copyright (C) 2010 by Roger Pettett
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.