The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

E2::Scratchpad - A module for loading and setting a user's E2 Scratch Pad.

SYNOPSIS

        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" );

DESCRIPTION

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.

CONSTRUCTOR

new

new creates a new E2::Scratchpad object.

METHODS

$scratch->load [ USER_ID ]

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.

Exceptions: 'Unable to process request', 'Parse error:'

$scratch->update [ TEXT ] [, SHARE ]

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'

$scratch->shared
$scratch->user
$scratch->text

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.

SEE ALSO

E2::Interface, E2::Ticker, http://everything2.com, http://everything2.com/?node=clientdev

AUTHOR

Jose M. Weeks <jose@joseweeks.com> (Simpleton on E2)

COPYRIGHT

This software is public domain.