Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
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]
[shmem]: holli: all of our machinery is more perfect in its realm than any human being in theirs (Günther Anders), which doesn't mean not having fun, albeit dangerous sometimes.
[ww]: That's a big "if", holli.
[holli]: well the google car drove 5 times as far as the average human without an accident didnt it?
[ww]: Less than confident that ai+hardware is up (yet) to randomness and counterintuitive behavior on streets of NY

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (16)
As of 2017-11-21 13:16 GMT
Find Nodes?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:

    Results (301 votes). Check out past polls.