E2::Scratchpad - A module for loading and setting a user's E2 Scratch Pad.
use E2::Scratchpad;
use E2::User; # We need to get a user's user_id
my $scratch = new E2::Scratchpad;
# Load nate's scratchpad
my $user = new E2::User;
$user->load( 'nate' )
or die "Can't load nate's homenode";
$scratch->load( $user->id )
or die "Can't load nate's scratchpad";
.......
# Login and load your own scratchpad
$scratch->login( "username", "password" )
or die "Unable to login";
$scratch->load
or die "Can't load your scratchpad";
# Display your scratchpad
print $scratch->user . "'s scratchpad:\n";
print "(Other users can " .
($scratch->shared ? '' : 'NOT ') .
"view your scratchpad.)\n";
print "-------------------------------\n";
print $scratch->text;
# Update your scratchpad
$scratch->update( "Scratchpad text goes here\n" );
This module allows access to user's scratchpads (with read and write access to a user's own scratchpad and read access to the scratchpad of any user who chooses to share his publicly.
new creates a new E2::Scratchpad object.
If USER_ID is specified, it attempts to fetch the scratchpad of that user (who may or may not have chosen to share it publicly). If USER_ID is not specified, it fetches the scratchpad of the currently-logged-in user.
This method returns true on success and undef on failure.
Exceptions: 'Unable to process request', 'Parse error:'
If either parameter is undefined, it is ignored. Pass an empty string as TEXT to clear the scratchpad, and 0 as SHARE to set the scratchpad as not shared.
Exceptions: 'Unable to process request'
load must be called before any of these values will be defined.
the E2::Interface manpage, the E2::Ticker manpage, http://everything2.com, http://everything2.com/
Jose M. Weeks <jose@joseweeks.com> (Simpleton on E2)
This software is public domain.