E2::Session - Load session information about the current E2 user
use E2::Session; my $session = new E2::Session; $session->login( "username", "password" ); # See E2::Interface $session->update; print "Username: " . $session->this_username; # See E2::Interface print "\nuser_id: " . $session->this_user_id; # See E2::Interface print "\nVotes left today: " . $session->votes; print "\nCools left today: " . $session->cools; print "\nExperience: " . $session->experience; print "\nWriteups: " . $session->writeups; print "\nBorged: " . ($session->borged ? "Yes" : "No"); print "\nForbidden to post: " . ($session->forbidden ? "Yes" : "No"); print "\nServer time: " . $session->time; if( $session->xpchange ) { print "\nChange in XP: " . $session->xpchange; print "\nTo reach level " . $session->nextlevel->{level}; print "\n XP:" . $session->nextlevel->{experience}; print "\n Writeups:" . $session->nextlevel->{writeups}; } foreach( $session->list_personal_nodes ) { print "\nPersonal node: $_->{title}"; }
This module allows a user to load his session information This module provides an interface to everything2.com's search interface. It inherits E2::Ticker.
new creates an E2::Session object.
new
E2::Session
This method clears all stored session values.
This method fetches the personal session from e2 and makes available all of the access methods below. If a user is not logged in, the only session information fetched will be the servertime (retrievable via time) and this user's username and user_id (retrievable via this_username and this_user_id, which are inherited from E2::Interface).
time
this_username
this_user_id
xpchange and nextlevel are only available if the user's writeup count or experience number has changed since the user's session was last loaded. update works very much like the epicenter nodelet on E2, and "last loaded" refers to either updating the session or loading a web page that contains the epicenter.
xpchange
nextlevel
update
One other side-effect of calling update (or loading the epicenter) is that a user who's been borged must do so at least once, after the length of his borging has expired, before he will be able to speak again.
These methods return the user's number of votes left today, number of cools left today, their current experience number, their current number of writeups, and the current server time. Example server time: "Sun Mar 16 15:58:20 2003".
These methods return values corresponding, respectively, to whether the current user has been borged and whether the current user has been forbidden to post writeups. Both return boolean values, but forbidden, if true, is a text string describing the lock.
forbidden
This method returns the user's change in experience since that previous time he updated his user session (or loaded an epicenter nodelet). It is only defined if either the user's experience number or writeup count has changed since the previous update.
This method returns information about requirements the user must meet to reach the next level. It is only defined if either the user's experience number or writeup count has changed since the previous update (either by a call to update or by loading the epicenter nodelet).
This method returns a hashref with the following keys:
experience # Extra experience required to level up writeups # Extra writeups required to level up level # The next level as an integer
E2::Interface, E2::Ticker, http://everything2.com/?node=clientdev http://everything2.com/?node=e2interface
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.