At 2004-11-15T12:51:26+1300, Nick Rout wrote:
> perhaps an exercise for the list, write a script to get your gmail
> atom feed and display a nicely formatted list of the emails.
> 3 lines or less? perl one liner?
Do you _really_ want to see it as a one-liner?
$ curl -u user:pass https://gmail.google.com/gmail/feed/atom | perl -e 'use
XML::Simple;sub p{($s,$f,$e,$d)[EMAIL PROTECTED];print"Subject:
$s\n";print"From: $f <$e>\tDate:
$d\n\n"};$x=XMLin(\*stdin);foreach$k(keys%{$x->{entry}}){$m=$x->{entry}{$k};p$m->{title},$m->{author}{name},$m->{author}{email},$m->{modified};}'
I have to admit, it's a pretty lazy attempt--it should be possible to
reduce the length of that one-liner even further. A nicely formatted
but completely uncommented version is attached, if anyone actually wants
to know what the script is doing.
Cheers,
-mjg
--
Matthew Gregan |/
/| [EMAIL PROTECTED]
use XML::Simple;
sub printMsgHdr {
my ($s, $f, $e, $d) = @_;
print "Subject: $s\n";
print "From: $f <$e>\tDate: $d\n\n"
}
$x = XMLin(\*stdin);
foreach $k (keys %{$x->{entry}}) {
$m = $x->{entry}{$k};
printMsgHdr $m->{title}, $m->{author}{name}, $m->{author}{email},
$m->{modified};
}