The Perl Journal, issue 13

Michael Fowler wolfm at pobox.alaska.net
Fri Apr 23 22:36:18 CDT 1999


Local Perl Mongers,

I just got my issue of The Perl Journal today.  I thought I'd share what
interesting tidbits I've gleaned in the half hour or so of reading, seeing as
noone else seems to be sharing anything.  I'm not sure how many of you out
there have subscriptions, but if you don't and enjoy Perl, I would suggest
getting one (www.tpj.com).

I saw a blurb about VelociGen 1.1 inside the front cover.  It looks like
mod_perl with Tcl and XML support (I'm not much into XML, so I'm not sure
exactly what there is to support).  It might be worth looking into.

This Perl Mongers list is listed in the News section, yay!

ddd (the data display debugger) now has Perl support.

Net::Whois 0.23 has been released.  Hopefully its better than the last time
I tried using it.. I ended up rolling my own.

The CPAN scripts archive is now up and running
(www.per.com/CPAN/scripts/index.html).  It's about time.  You'll need a
PAUSE account to upload scripts, information for which can be found at
www.perl.com/CPAN/modules/04pause.html.

TPJ Perl Oneliner #29 may prove insanely useful:
	sub is_balanced {
		my $it = $_[0];
		$it =~ tr/()[]{}//cd;
		while ($it =~ /\(\)|\[\]|\{\}//g) { 1 }
		return !length($it);
	}
This subroutine returns true if all of the parens, brackets, and braces in
the string are balanced.

Another useful TPJ Perl Oneliner (#32):
	($definition) = <<'FINIS') =~ s/^\s+//gm;
		The five varieties of camelids are the familiar
		camel, his friends the llama and the alpaca, and
		the rather less well-known guanaco and vicuna.
	FINIS
this allows you to indent a here-doc without printing the indentation.  One
caveat, however: you can't use it in conjunction with a subroutine (e.g. die
<<'End_of_Death' =~ s/^\s+//gm; won't work). 

A useful article on XML is a must-read, now all I have to do is read it..
Ditto for a review of the O'Reilly Perl Resource Kit.

I read through an article on Localization.  Included was a horror-story of
what it's like to localize a program with gettext (a C library for looking
up translated versions of a string in a lexicon).  I was dutifully horrified.
The author then describes his module, Locale::Maketext, which seems utterly
logical, and better than gettext, but beyond that I got lost.  If you're
trying to do localization, and are using Perl, you should look into this
module.

By far the most interesting article in this issue was a Perl Heresy by Greg
Bacon, entitled "Perl Heresies: Building Objects Out of Arrays".  In the
past I have considered using other data types for objects, but hashes are
simply more flexible.  However, this was a poorly thought-out assumption. 
Arrays are faster and use less space, and if done correctly, can provide
just as much flexibility.

When considering arrays as objects one tends to think of the awkwardness of
using unfriendly and faceless numbers for indexing, and one tends to then be
put off.  However, mixed with constants (perldoc constant), this problem is
easily alleviated.  Not only that, but using constants and use strict adds
extra functionality, such as compile-time errors when a key is misspelled.

All in all, it's a very good article.  I may even decide to use arrays as
objects in my next project...


Welp, that's what I got out of it so far.  Hopefully you found something
interesting as well.

Discussion, questions, comments, flames?


Respectfully,
Michael
--
There isn't a mome rath alive that can outgrabe me.
--
===============================================================
Mailing list info:  If at any time you wish to (un|re)subscribe to the list send the
request to majordomo at hfb.pm.org.  All requests should be in the body, and look
like such
                  subscribe anchorage-pm-list
                  unsubscribe anchorage-pm-list



More information about the Anchorage-pm mailing list