E2::Ticker - A module for fetching http://everything2.com's tickers.
use E2::Ticker;
my $ticker = new E2::Ticker;
# List New Writeups
print "New Writeups:\n-------------\n";
foreach my $n ($ticker->new_writeups) {
print $n->{title} . "\n";
}
# List Other Users
print "\nOther Users:\n------------\n";
foreach my $u ($ticker->other_users) {
print $u->{name};
print '[$]' if $u->{editor};
print '[@]' if $u->{god};
print "\n";
}
# (and so on...)
This module provides an interface for fetching http://everything2.com's New Writeups, Cool Nodes, Editor Cools, Random Nodes, Other Users, Time Since, Available Rooms, Best Users, Node Heaven, Maintenance Nodes, Scratch Pad, and Raw Vars, and Interfaces tickers. It also serves as a base class for other modules that load ticker pages.
new creates a new E2::Ticker object.
The returned hashrefs have the following keys:
title # Writeup title
id # node_id
type # type (person, place, thing, or idea)
author # Author's username
author_id # Author's user_id
parent # Parent node
parent_id # Parent's node_id
Exceptions: 'Unable to process request', 'Parse error:'
The returned hashrefs have the following keys:
name # Username
id # user_id
god # Boolean: Member of gods group?
editor # Boolean: Member of Content Editors group?
edev # Boolean: Member of edev group?
xp # User's experience number
borged # Is this user borged?
# The following are only defined if user is not "outside"
room # Name of the room user is in
room_id # node_id of room user is in
NOTE: only users who are members of edev are able to determine whether another user is an edev member.
Exceptions: 'Unable to process request', 'Parse error:'
The returned hashrefs have the following keys:
title
id
This method also retrieves the ``random wit'' from everything2, which is then retrievable by calling random_wit.
Exceptions: 'Unable to process request', 'Parse error:'
The returned hashrefs have the following keys:
title # Title of the writeup
id # node_id
author # Author's username
author_id # Author's user_id
cooledby # Username of user who C!d the writeup
cooledby_id # user_id of user who C!d the writeup
Exceptions: 'Unable to process request', 'Parse error:'
The returned hashrefs have the following keys:
title # Title of the node (not writeup) edcooled
id # node_id
editor # Username of the editor who cooled the node
editor_id # user_id of the editor who cooled the node
Exceptions: 'Unable to process request', 'Parse error:'
Otherwise, USER_LIST should be a list of either usernames or user_ids.
It returns a list of hashrefs with the following keys:
name # Username
id # user_id
time # The last time this user was seen
time_since determines whether the USER_LIST is composed names or ids by testing to see if the items in the list are all integers or not. This means that, if a user has a name that is also a valid integer, this name must be passed in a list with other usernames that are not.
time_since also fetches the current time, which is retrievable via a call to time_since_now.
Exceptions: 'Unable to process request', 'Parse error:'
Each item in this list is a hashref with the following keys:
title # The room's title
id # The room's node_id
This method returns undef on failure.
Exceptions: 'Unable to process request', 'Parse error:'
Each item in the returned list is a hashref with the following keys:
user # Username of this user
id # user_id of this user
experience # This user's experience number
writeups # The number of writeups this user has posted
level # The level of this user (integer)
level_string # The level string of this user
# Example: "11 (Godhead)"
NOTE: The e2 server currently ignores the NOGODS option (ebu_noadmins) and instead serves a list based upon the logged-in user's preference (specified in a checkbox on http://everything2.com/?node=Everything's+Best+Users). The NOGODS option should be considered broken (ignored) until this is resolved serverside.
Exceptions: 'Unable to process request', 'Parse error:'
If the current user is not logged-in, this method returns undef.
Each element in the returned list is a hashref with the following keys:
title # The title of the writeup
id # The node_id of the writeup
reputation # The reputation the writeup had when deleted
createtime # The timestamp of the writeup's creation
If NODE_ID is specified, the additional key will be included:
text # The text of the writeup
Exceptions: 'Unable to process request', 'Parse error:'
title # Title of node
id # node_id of node
Exceptions: 'Unable to process request', 'Parse error:'
Exceptions: 'Unable to process request', 'Parse error:'
load_interface to make sure it's using the up-to-date list of ticker interfaces.
The loaded list can be accessed by calling interfaces.
This method returns true on success.
Exceptions: 'Unable to process request', 'Parse error:'
random_nodes. Returns undef if none have been fetched.
time_since. Returns undef if that method has not been called.
E2::Interface::document).
use_string only affects the next ticker-loading method called. Example usage:
my $xml_string = ... ;
$ticker->use_string( $xml_string );
my @w = $ticker->new_writeups; # loaded from $xml_string
my @w2 = $ticker->new_writeups; # This time it's loaded from the
# e2 servers.
use_string does not check whether the string is of the proper type for that particular ticker-loading method, nor does it check whether or not the string is valid XML. If you use this method, it is assumed you know what you are doing.
the E2::Interface manpage, the E2::Search manpage, the E2::Usersearch manpage, the E2::Message manpage, the E2::Session manpage, the E2::ClientVersion manpage, the E2::Scratchpad manpage, http://everything2.com, http://everything2.com/
Jose M. Weeks <jose@joseweeks.com> (Simpleton on E2)
This software is public domain.