Re: Perl 5.12 complains about ecpg parser-hacking scripts
Andrew Dunstan <andrew@dunslane.net>
From: Andrew Dunstan <andrew@dunslane.net>
To: Andy Colson <andy@squeakycode.net>
Cc: kris@shannon.id.au, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2011-01-23T16:06:11Z
Lists: pgsql-hackers
On 01/23/2011 10:16 AM, Andy Colson wrote:
> On 01/23/2011 08:29 AM, Andy Colson wrote:
>> On 01/22/2011 09:28 PM, kris@shannon.id.au wrote:
>>> On 23 January 2011 13:14, Andrew Dunstan<andrew@dunslane.net> wrote:
>>>> But there are quite a few perlheads around. ISTR Matt Trout was
>>>> muttering
>>>> about these scripts on IRC recently.
>
> Ok, so I've figured out what its purpose is.
>
> Are there other problems with this script? Does it not pull out the
> rule names correct all the time or something? What problem was Matt
> having with it?
>
> I think rewriting from scratch is overkill, unless this script is just
> failing. The code to pull the rule names out is a bit complex, and it
> seems to work, so I'd rather not touch it.
>
> Are there other things you wished this script did? (reports, counts,
> etc)
>
>
It's doing the right thing. But it's really spaghetti code, generated by
a2p. Matt was just (rightly) offended by the $[ setting, IIRC.
The point is that it's close to being totally unmaintainable.
But if you think you can remedy it without rewriting it, go for it.
I think minimum requirements would be:
* avoid setting $[
* use strict;
* comments saying what it's actually doing
We want to be in a situation where of it ever does break because of some
external change, we're not left having to wade through the crap to find
out how to fix it.
cheers
andrew