See issue 5 of The Perl Journal for my article on X in Perl.

The code is available here.

Updates:

Please send comments, patches, or suggestions related to this code only to eichin-wwwmit@thok.org (see my email page for details.)