Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
PerlMonks Journal into RSS Feed

by rjray (Chaplain)
on Mar 14, 2002 at 08:10 UTC ( #151625=sourcecode: print w/replies, xml ) Need Help??
Category: Web stuff
Author/Contact Info rjray

The use Perl; site is starting to provide SOAP interface support to the journal system there. Much of the interface is still alpha, and I'm trying to help out pudge by testing what he has, and offering suggestions here and there as I run into things.

This is a simple demonstration/proof-of-concept script that uses SOAP::Lite and XML::RSS to turn the last 15 journal entries from a given user into a RSS 1.0 syndication channel.

Caveats: There is not yet an interface for turning a nickname into a user-ID, so you have to provide the user ID as the first (and only required) parameter to the script. You may provide the nickname as the second parameter. The titles and such are very simple, as this goes for minimal network traffice over feature-bloat. But it's mostly for illustrative purposes. As the interface fleshes out and becomes more stable, I expect to have a more functional version of this. Oh, and it writes to STDOUT, making it suitable as a filter to other XML/RSS processing apps.

#!/usr/bin/perl -w

use strict;

use SOAP::Lite;
use XML::RSS;

my $user = shift ||
    die "Usage: $0 userID [ usernick ]\n\nStopped";
my $nick = shift || "#$user";

my $host        = '';
my $uri         = "http://$host/Slash/Journal/SOAP";
my $proxy       = "http://$host/";

my $journal = SOAP::Lite->uri($uri)->proxy($proxy);
my $results = $journal->get_entries($user, 15)->result;
my $rss     = XML::RSS->new(version => '1.0');

$rss->channel(title       => " journal of $nick",
              'link'      => $proxy,
              description => "The journal of $nick");
$rss->add_item(title  => $_->{subject}, 'link' => $_->{url})
    for (@$results);

print STDOUT $rss->as_string;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://151625]
[perldigious]: A question since I'm ignorant of what's normal for database management... Do admins change column names a lot in databases?
[perldigious]: On occasion my scripts break, because they will do something that seems laregly pointless to me... like in this case, changing a column name from "ABC Category" to "ABC Category Override".

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2017-05-25 13:25 GMT
Find Nodes?
    Voting Booth?