WWW-Scrape-Mailman-RSS
view release on metacpan or search on metacpan
lib/WWW/Scrape/Mailman/RSS.pm view on Meta::CPAN
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Scrape::Mailman::RSS;
my $feed = WWW::Scrape::Mailman::RSS->new(
'rss_version' => '0.91',
'debug' => 0, # try values from 1 to 5 for noisier output
);
my %args = (
'info_url' => 'http://ga.greens.org/mailman/listinfo/gpga-news',
'base_url' => 'http://ga.greens.org/pipermail/gpga-news',
'list_name' => 'gpga-news',
'audience' => 'Greens',
'description' => 'News by, about and for Greens',
'cycles' => 2,
'output_file' => '/home/hesco/sites/news.tns.campaignfoundations.com/gpga_news_feed.html',
'rss_output' => '/home/hesco/sites/news.tns.campaignfoundations.com/gpga_news_feed.rss',
);
$feed->render_feed(\%args);
# create additional feeds for other lists here
1;
Then on your site, set your feed aggregator to point to:
http://news.tns.campaignfoundations.com/gpga_news_feed.rss
=head1 METHODS
=head2 WWW::Scrape::Mailman::RSS->new( \%defaults )
Given a hashref of defaults which includes the key
'rss_version', construct and returns a $feed object, including
embedded objects for WWW::Mechanize, HTML::TableExtract,
XML::Twig and XML::RSS. If $defaults->{'debug'} is set, you
can see debugging output; with the noise level increasing as
t/00-load.t view on Meta::CPAN
use lib qw( lib );
use WWW::Scrape::Mailman::RSS;
BEGIN {
use_ok( 'WWW::Scrape::Mailman::RSS' );
}
my $feed = WWW::Scrape::Mailman::RSS->new({
'debug' => 1,
'rss_version' => '0.91',
'rss_output' => 't/tmp/home/hesco/tns.campaignfoundations.com/newsfeeds/gpga_news_feed.rss',
});
isa_ok($feed,'WWW::Scrape::Mailman::RSS');
isa_ok($feed->{'agent'},'WWW::Mechanize');
isa_ok($feed->{'te'},'HTML::TableExtract');
isa_ok($feed->{'twig'},'XML::Twig');
isa_ok($feed->{'rss'},'XML::RSS');
my @methods = ('new','render_feed','_parse_mm_archive_cycle');
foreach my $method (@methods){
can_ok($feed,$method);
}
my %args = (
'info_url' => 'http://ga.greens.org/mailman/listinfo/gpga-news',
'base_url' => 'http://ga.greens.org/pipermail/gpga-news',
'list_name' => 'gpga-news',
'audience' => 'Greens',
'description' => 'News by, about and for Greens',
'cycles' => 2,
'output_file' => 't/tmp/home/hesco/tns.campaignfoundations.com/newsfeeds/gpga_news_feed.html',
'rss_output' => 't/tmp/home/hesco/tns.campaignfoundations.com/newsfeeds/gpga_news_feed.rss',
'template' => 't/tmpl/gpga_news_feed.tmpl',
);
my $news_feed = $feed->render_feed(\%args);
open('OUTPUT','>',"$args{'output_file'}") or die 'Unable to open: ' . $args{'output_file'} . "\n";
print OUTPUT $news_feed;
close OUTPUT;
my $latest_month = '2011-February';
my $next_latest_month = '2011-January';
( run in 1.004 second using v1.01-cache-2.11-cpan-df04353d9ac )