Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: XML::Simple chatterbox dumper

by mirod (Canon)
on Aug 16, 2001 at 10:04 UTC ( #105279=note: print w/ replies, xml ) Need Help??


in reply to XML::Simple chatterbox dumper

And you thought I'd let get away without forcing an XML::Twig version upon you?

Of course you need a recent (3.00.18 or above) version of the module in order to get the parseurl method, otherwise you will need to use LWP to get the text first.

#!/bin/perl -w use strict; use XML::Twig; use constant URL => q{http://perlmonks.org/index.pl?node=chatterbox+xm +l+ticker}; my $t= XML::Twig->new( twig_handlers => { message => \&display_message + }); $t->parseurl( URL); sub display_message { my( $t, $msg)= @_; my $auth = $msg->att( 'author'); my $cont = $msg->text; my $time = $msg->att( 'time'); my ($h,$m,$s) = $time =~ /^\d{8}(\d\d)(\d\d)(\d\d)$/; $cont =~ s/\n//g; $cont =~ s/^\/me/$auth/; print "$h:$m:$s - [$auth] $cont\n"; }


Comment on Re: XML::Simple chatterbox dumper
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://105279]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (14)
As of 2015-07-02 10:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (34 votes), past polls