Diego's PerlMonks page

I like Perl. And one of the best sites to find Perl information, code, and a very friendly community, is PerlMonks.org, where you can find me as ZZamboni.

The PerlMonks modules

PerlMonks.org has many nice features, such as the chatbox (where you can talk to other users), the Newest Nodes page (where you can see which nodes you haven't read), it gives each user a personal home page, etc.

Some time ago I wrote a quick script to grab the chatbox from the web page and display the messages in the terminal. It quickly evolved into a more sophisticated thing, becoming able to post messages, check off personal messages, etc. It has benefited a lot from the expertise of other Perl monks which have found it useful and contributed code and ideas.

Later, I added a module to manage the Newest Nodes page, making it possible to display it in a threaded form, mark messages as read, etc. I also added a module for accessing user information, such as your experience level.

So what started as simple module has grown into a family of them, including PerlMonks::Chat, PerlMonks::NewestNodes and PerlMonks::User. You can grab the whole thing here (also in in zip format). See below for the latest changes, or check the Change log. I'll add documentation as I have time. You can check the included sample programs (getchat.pl and pmpager.pl) to see how the modules are used. The idea is for the PerlMonks modules to be used as a back end for different user interfaces. See below for the list of programs that use these modules.

You can also get the old version (also in zip) of the module, which includes only the PerlMonksChat class (doesn't have the Newest Nodes or user information functionality, only chatbox). I am no longer maintaining this version, and the new one is backwards compatible, so you should no longer use the old one.

I have included a simple driver program in getchat.pl. It is very crude, but it works. Simply type messages to send them (including /msg), and type "/checkoff <number> ..." to check off personal messages. You can also try the pmpager.pl program, which can check your personal messages and either display them or email them to you.

Of course, you are encouraged to use these modules in any way you want, hack them, extend them, and send me back your changes or suggestions. I'll use them if they are good, and give you proper credit.

Enjoy.

Programs that use PerlMonksChat.pm

These are the ones I know about. If you know some other, please send me a link.

I have not tested most of these (except for the Perl/Tk Newest Nodes and Chat clients, which I use regularly). If you have problems with them, please contact their authors directly (unless you are sure it's a problem with the PerlMonksChat.pm module).

Updates

November 29 2000, 15:29
I have made several changes in the last month or so, but haven't had time to announce them individually here. Check the Change log for the details. Major changes: PerlMonks::Chat can now expand things of the form [id://node_id] to the node title, and PerlMonks::NewestNodes now keeps persistent storage of the state (read or unread) of the nodes.
October 23 2000, 17:51
Now PerlMonks::NewestNodes uses the new node query facility available at perlmonks.org (I don't think it was announced anywhere, but try "http://www.perlmonks.org/index.pl?node=node+query+xml+generator&nodes=", appending a comma-separated list of nodes after the last equal sign) to properly do threading. So now if the parent of a node in your Newest Nodes list is not in the list anymore, it requests its information and inserts it into the thread, marking it as already read. Also fixed a bug in the PerlMonks::login() subroutine, thanks to Shendal.
September 10, 12:45
Wrote a new program called pmpager.pl, which gets your personal messages and mails them or displays them to you. It can optionally check them off if you want. This program is now part of the 2.0 distribution, since it uses the PerlMonks::Chat module.
September 8, 16:49
The PerlMonks::NewestNodes module now can keep an internal "read/unread" status for each node. I also added a thread-visiting method and some other utility methods.
September 7, 20:46
In an effort to intelligently thread nodes whose parents have already been marked as read, PerlMonks::NewestNodes now creates "fake parents" for those nodes. Works to a certain degree, but it's limited because it can only go up one level. This is, if the "real parent" is child to another node, the "fake parent" has no way of including this information, which results in fragmented threads anyway. Also, there's no way of knowing what the nodetype of the real parent is, so the fake parent has to inherit its child's (except in the case of categorized answers).
September 6, 18:31
Changes to the PerlMonks::NewestNodes module: now each node has a node_id field, and there are two new methods: clear_nn() for marking the Newest Nodes as seen, and reset_nn() for resetting the flag.
September 5, 13:10
The first version of the PerlMonksChat2.zip file was missing a few files. If you got that file and the PerlMonks/ subdirectory is empty (or nonexistent), please download it again. The PerlMonksChat2.tar.gz file was not affected by this problem. Thanks to Shendal for catching this.
September 5, 1:06
The first release of version 2.0 of the PerlMonks modules is out. In this release, the functionality has been split and reorganized among different modules. Among other things, it provides now a threaded interface to the Newest Nodes page. Check it out! Right now it's in its very early stages, but it may be usable. Please read the README and the ChangeLog in the package to get a better idea of what has changed.
September 2, 12:01
The xp() subroutine in PerlMonksChat (and the /xp command in getchat.pl) now gets the user that you are logged in as. Thanks to vroom for adding that to the XML XP ticker!
August 25, 2000, 11:51
I worked around the problem with the HTML entities (below) by using an ugly hack (converting [ to [[] and < to [<], which results in them being shown correctly, but as links), so the new escape sequences can now be used. I hope this will be fixed at the server end.
August 25, 2000, 10:58
Made send() convert \[, \], \< and \> to the appropriate HTML entities before sending, so that it's easier to type brackets (square and angle) in the chatbox. Note: Please don't use these features yet. They don't work properly in regular chatbox messages, only in personal messages.

Also added two additional forms to the /co command: "/co all" checks off all personal messages, and "/co last x" checks off the last x messages (defaults to 1 if omitted).

July 6, 2000, 13:01
Made it escape some additional characters in the strings when posting messages, because things like "+" and ";" were causing trouble.
June 2, 2000, 16:42
Added /xp command for displaying your XP, rank and voting information.
June 2, 2000, 01:45
Added /who command (alias /users) for listing other users logged in. Also added proper support for "/me" in messages (replacing it by the user name).
June 1st, 2000, 14:30
PerlMonksChat.pm now uses the new XML tickers implemented by vroom. The external interface of the module hasn't changed, so any programs built around it should not have any problems.

Return to my home page.


Diego Zamboni
Last modified: Wed Nov 29 15:32:46 EST 2000