NAME

WWW::Yahoo::Groups - automated access to Yahoo! Groups.

SYNOPSIS

my $y = WWW::Yahoo::Groups->new();
$y->login( $user => $pass );
$y->list( 'Jade_Pagoda' );
my $email = $y->fetch_message( 2345 );

# Error catching
my $email = eval { $y->fetch_message( 93848 ) };
if ( $@ and ref $@ and $@->isa('X::WWW::Yahoo::Groups') )
{
    warn "Problem: ".$@->error;
}

ABSTRACT

WWW::Yahoo::Groups retrieves messages from the archive of Yahoo Groups. It provides a simple OO interface to logging in and retrieving said messages which you may then do with as you will.

DESCRIPTION

WWW::Yahoo::Groups is a subclass of WWW::Mechanize, overriding a few methods and supplying a few extra. As such, any method available in WWW::Mechanize is available to WWW::Yahoo::Groups, perhaps augmented with extra features.

It is recommended that you use this only if you're the moderator of a group, else you will get munged email addresses for everything. If there's sufficient demand for semi-automatic address demunging, I'll add it.

All exceptions are subclasses of X::WWW::Yahoo::Groups, itself a subclass of Exception::Class.

Things it does

  • Handles access restricted archives. It lets you login.

  • Handles the intermittent advertisements. It notes that it got one and progresses straight to the message.

  • Handles attachments. We get the source which happens to be the raw stuff.

  • Sanity checking. Could be improved, but it will generally barf if it doesn't understand something.

Things it is yet to do

  • Handle errors. Well, it does, but not as gracefully as it might in some situations.

  • Header restoration. I've found that some groups' archives have unusually corrupted headers. Evidently it would be beneficial to restore these headers. As far as I can tell, it comes from not being a moderator on the lists in question.

As this is a recognised flaw, they are on the TODO list.

METHODS

new()

Create a new WWW::Yahoo::Groups robot.

my $y = WWW::Yahoo::Groups->new();

debug()

Enable/disable/read debugging mode.

$y->debug(0); # Disable
$y->debug(1); # Enable
warn "Debugging!" if $y->debug();

get()

Fetch a given URL.

If debug() is enabled, then it will displaying a warning showing the URL.

$y->get( 'http://groups.yahoo.com' );

Generally, you won't need to use this method. It's used by a number of the othe rmethods and will throw a X::WWW::Yahoo::Groups::BadFetch if it is unable to retrieve the specified page.

login()

Logs the robot into the Yahoo! Groups system.

$y->login( $user => $passwd );

May throw:

  • X::WWW::Yahoo::Groups::BadFetch if it cannot fetch any of the appropriate pages.

  • X::WWW::Yahoo::Groups::BadParam if given invalid parameters.

  • X::WWW::Yahoo::Groups::BadLogin is unable to log in for some reason (error will be given the text of the Yahoo error).

list()

Set/gets which list to use.

IMPORTANT: list name must be correctly cased as per how Yahoo! Groups cases it. If not, you may experience odd behaviour.

$y->list( 'Jade_Pagoda' );
my $list = $y->list();

May throw X::WWW::Yahoo::Groups::BadParam if given invalid parameters.

fetch_message()

Fetches a specified message from the list's archives. Returns it as a mail message (with headers) suitable for saving into a Maildir.

my $message = $y->fetch_message( 435 );

May throw any of:

  • X::WWW::Yahoo::Groups::BadFetch if it cannot fetch any of the appropriate pages.

  • X::WWW::Yahoo::Groups::BadParam if given invalid parameters.

  • X::WWW::Yahoo::Groups::NoListSet if no list is set.

  • X::WWW::Yahoo::Groups::UnexpectedPage if we fetched a page and it was not what we thought it was meant to be.

  • X::WWW::Yahoo::Groups::NotThere if the message does not exist in the archive (any of deleted, never archived or you're beyond the range of the group).

fetch_rss()

Returns the RSS for the gruop's most recent messages. See XML::Filter::YahooGroups for ways to process this RSS into containing the message bodies.

my $rss = $w->fetch_rss();

THANKS

Simon Hanmer for having problems with the module, thus resulting in improved error reporting, param validation and corrected prerequisites.

Aaron Straup Cope for writing XML::Filter::YahooGroups which uses this module for retrieving message bodies to put into RSS.

Randal "Merlyn" Schwartz for pointing out some problems back in 1.4.

BUGS

Please report bugs at <bug-www-yahoo-groups@rt.cpan.org> or via the web interface at http://rt.cpan.org

LICENSE AND COPYRIGHT

Copyright © Iain Truskett, 2002. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Iain Truskett <spoon@cpan.org>

SEE ALSO

perl, WWW::Mechanize, XML::Filter::YahooGroups, Exception::Class, http://groups.yahoo.com/.