Skip to content

Instantly share code, notes, and snippets.

@marcust
Created October 19, 2011 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcust/1299398 to your computer and use it in GitHub Desktop.
Save marcust/1299398 to your computer and use it in GitHub Desktop.
Export use.perl.org content as RSS
#!/usr/bin/perl -w
use strict;
use SOAP::Lite;
use XML::RSS;
use DateTime::Format::Flexible;
use DateTime::Format::Mail;
my $user = shift ||
die "Usage: $0 userID [ usernick ]\n\nStopped";
my $nick = shift || "#$user";
my $host = 'use.perl.org';
my $uri = "http://$host/Slash/Journal/SOAP";
my $proxy = "http://$host/journal.pl";
my $journal = SOAP::Lite->uri($uri)->proxy($proxy);
my $results = $journal->get_entries($user, 50)->result;
my $rss = XML::RSS->new(version => '2.0');
$rss->channel(title => "use.perl.org journal of $nick",
'link' => $proxy,
description => "The use.perl.org journal of $nick");
for my $entry (@$results) {
my $data = $journal->get_entry( $entry->{id} )->result;
my $formattedDate = DateTime::Format::Mail->format_datetime(
DateTime::Format::Flexible->parse_datetime( $data->{date}));
$rss->add_item(title => $entry->{subject}, 'link' => $entry->{url},
description => $data->{body}, pubDate => $formattedDate )
}
print STDOUT $rss->as_string;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment