$pgn->comments was Re: DCPM: perltutopen blues....

Simon Waters Simon at wretched.demon.co.uk
Mon Jul 7 07:00:55 CDT 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Matthew Browning wrote:
>
>> I was trying something like "%{$pgn->comments} = [ my %empty ]", but
>> no joy...
>
>
> The package already assigns an empty hash for the comments; it just
> provides no public method to add to it.  In principal, there is nothing
> to stop you adding stuff to it but this is bad OO vibes:
>
> $pgn->{GameComments}->{key} = value;

Yes, but it doesn't work if there are no comments in the original file!
i.e. When the hash should be an empty hash.

Since "comments" returns a reference to "GameComments2, I don't think I
should be referring to GameComments (very bad vibes - depends on
implementation detail).

Reading the source I don't see how "comments" doesn't get initialised
either, perhaps I should capture the error message for you guys ;-)

Possible I've misunderstood something.

> ...this might be more an issue for the developer. I have read the
> module itself and found a couple of bits of it confusing.  This is not
> helped by the fact that I do not appreciate what PGN files are, but if
> there is a genuine reason for needing this method in the package then
> the author should know about it (I suppose).

PGN is literally a simple text based notation for chess moves. The only
complexity being you nearly always want to handle human typed PGN which
never adheres to the standard ;-)

I'm treating comments as strings (there is code in Parse.pm to handle
other cases). RAV is merely comments within comments, which I'm
ignoring, who cares how many brackets are inside a string ;-)

Glad you find bits confusing.

I think adding comments to an existing game is a reasonable use of the
"module", although it might not fit the modules name, or quite what the
authors intended.

But as you say, it isn't clear why an empty hash isn't provided/working,
even if I'm poking data straight into an objects "private" areas.
-----BEGIN PGP SIGNATURE-----
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE/CWDzGFXfHI9FVgYRAoIwAJ9xppG1fxfbKpaLoetmk+5rsNAXtgCcDeOg
6LzGH1Ld7TsAwK+r3xoCWX8=
=MRFd
-----END PGP SIGNATURE-----



More information about the Devoncornwall-pm mailing list