WWW::Sitebase::Navigator is a base Perl class for modules that navigate web sites.
SYNOPSIS
This module is a base class for modules that navigate web sites like Myspace or Bebo. It provides basic methods like get_page and submit_form that are more robsut than their counterparts in WWW::Mechanize. It also provides some core methods like "site_login". If you subclass this module and override the "site_info" method, you'll have a module that can log into your web site. Ta Da.
Note that this module is a subclass of "Spiffy" using "use Spiffy -Base". perldoc Spiffy for more info or look it up on CPAN. Most importantly this means we use Spiffy's "field" method to create accessor methods, you don't need to include "my $self = shift" in your methods, and you can use "super" to call the base class's version of an overridden method.
use WWW::Sitebase::Navigator -Base;
field site_info => {
home_page => 'http://www.myspace.com', # URL of site's homepage
account_field => 'email', # Fieldname from the login form
password_field => 'password', # Password fieldname
cache_dir => '.www-MYSITE',
login_form_name => 'login', # The name of the login form. OR
login_form_no => 1, # The number of the login form (defaults to 1).
# 1 is the first form on the page.
login_verify_re => 'Welcome.*view my profile', # (optional)
# Non-case-sensitive RE we should see once we're logged in
not_logged_in_re => 'Sign In',
# If we log in and it fails (bad password, account suddenly
# gets logged out), the page will have this RE on it.
# Case insensitive.
home_uri_re => '?fuseaction=user&',
# _go_home uses this and the next two items to load
# the home page. You can provide these options or
# just override the method.
# First, this is matched against the current URL to see if we're
# already on the home page.
home_link_re => 'fuseaction=user',
# If we're not on the home page, this RE is
# used to find a link to the "Home" button on the current
# page.
home_url => 'http://www.myspace.com?fuseaction=user',
# If the "Home" button link isn't found, this URL is
# retreived.
error_regexs => [
'An unexpected error has occurred',
'Site is temporarily down',
'We hired monkeys to program our site, please wait '.
'while they throw bananas at each other.'
],
# error_regexs is optional. If the site you're navigating
# displays error pages that do not return proper HTTP Status
# codes (i.e. returns a 200 but displays an error), you can enter
# REs here and any page that matches will be retried.
# This is meant for IIS and ColdFusion-based sites that
# periodically spew error messages that go away when tried again.
};
IMPORTANT: If the site your module navigates uses ANY SSL, you'll need to add "Crypt::SSLEay" to your list of prerequisite modules. Otherwise your methods will die if they hit an SSL-encrypted page. WWW::Sitebase::Navigator doesn't require this for you to prevent unnecessary overhead for sites that don't need it.
Product's homepage
Requirements:
· Perl