$pgn->comments was Re: DCPM: perltutopen blues....
Simon Waters
Simon at wretched.demon.co.uk
Mon Jul 7 03:47:31 CDT 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Matthew Browning wrote:
>
> Perl filehandles look pretty much the same as in C. The ones you are
> dealing with are hidden behind two layers of obscurity.
Keep telling me that it isn't just me being thick ;-)
> Use cperl-mode, not the default perl-mode with GNU Emacs.
Hmm okay when I figure out how to change mode.... I'd already found
stuff in cperl-mode that sounded good whilst searching the help, so it
had made the "someting to look at later list" already. I have a zillion
little emacs questions, but I think they are probably best explained at
a LUG meet or similar.
The script is basically working as expected now, oh and Giuseppe has
updated Chess::PGN::Parse a couple of times to suit my needs (how is
that for free support!).
One gotcha whose syntax has escaped me (or perhaps I need another new
Parse.pm?), is the case where Chess::PGN::Parse doesn't find any
comments in the original game. Then the hash $pgn->comments is
undefined, and attempts to append new comments fail (can't put hash
pairs into a non-existent hash, I don't think we can blame the language
design for that one).
I assume I need to create an empty hash and assign it to the Parse
object, before attempting to append comments (this I assume is quicker
than checking if it is defined each time, but the "how" not the "when"
is escaping me).
I was trying something like "%{$pgn->comments} = [ my %empty ]", but no
joy...
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQE/CTOgGFXfHI9FVgYRAiA6AKCJM1l0eCQ3YETfHhmBC+oXriz4SwCgu94y
VBpZBbQuZBU45BIXvhnz36g=
=rK3i
-----END PGP SIGNATURE-----
More information about the Devoncornwall-pm
mailing list