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.
new
E2::Scratchpad
This method fetches a user's scratchpad.
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.
undef
Exceptions: 'Unable to process request', 'Parse error:'
If TEXT is specified, this method updates the text of the currently-logged-in user's scratchpad. If SHARE is specified, it tells the server whether this scratchpad is to be publicly shared or not.
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'
These methods return, respectively, the boolean: "Is this scratchpad publicly shared?"; the username of the user to whom this scratchpad belongs, and the text of this scratchpad.
load must be called before any of these values will be defined.
load
E2::Interface, E2::Ticker, http://everything2.com, http://everything2.com/?node=clientdev
Jose M. Weeks <jose@joseweeks.com> (Simpleton on E2)
This software is public domain.
To install E2::Interface, copy and paste the appropriate command in to your terminal.
cpanm
cpanm E2::Interface
CPAN shell
perl -MCPAN -e shell install E2::Interface
For more information on module installation, please visit the detailed CPAN module installation guide.