Help with Xtra

An instant messenger which can connect to AIM, GTalk, Jabber, ICQ, and more.
Post Reply
bizark
Harmless
Posts: 3
Joined: Wed Jan 26, 2005 10:32 pm

Help with Xtra

Post by bizark »

I'm trying to make a script that accesses google's atom feed and parses it. However for some reason all my code returns is a empty set of quotes. Below is the code any advice is appreciated.

Code: Select all

#!/usr/bin/perl

# Modules to use
use LWP::Simple;
use XML::RSS;
use LWP::UserAgent;
$ua = LWP::UserAgent->new;

my $content;

$gmail_user = USERNAME;
$gmail_password = PASSWORD;

# Accessing Atom feed
$req = HTTP::Request->new(GET => 'https://gmail.google.com/gmail/feed/atom');
$req->header('Accept' => 'text/html');
$req->authorization_basic($gmail_user, $gmail_password);
$res = $ua->request($req);

# Printing content
my $rss = new XML::RSS;
 $content = $res->content;
    die "Could not retrieve" unless $content;
    # parse the RSS content
    $rss->parse($content);
# print the HTML channel
&print_html($rss);

# SUBROUTINES
sub print_html {
 my $rss = shift;
      # print the channel items
   foreach my $item (@{$rss->{'items'}}) {
	next unless defined($item->{'title'}) && defined($item->{'link'});
	print "<li><a href=\"$item->{'link'}\">$item->{'title'}</a><BR>\n";
    }
    }

User avatar
zaudragon
Growl Team
Posts: 1852
Joined: Sat Dec 04, 2004 5:05 am
Location: Kensington, CA, USA
Contact:

Post by zaudragon »

Just a question: since Adium only supports AppleScript Xtras as script Xtras, how are you going to submit this?
Blog | X(tras)
Communists code without classes.
bizark
Harmless
Posts: 3
Joined: Wed Jan 26, 2005 10:32 pm

Post by bizark »

Code: Select all

do shell script "perl script.pl"
return result
User avatar
zaudragon
Growl Team
Posts: 1852
Joined: Sat Dec 04, 2004 5:05 am
Location: Kensington, CA, USA
Contact:

Post by zaudragon »

cool, I was just unsure :D
Blog | X(tras)
Communists code without classes.
Post Reply