dmitri has asked for the wisdom of the Perl Monks concerning the following question:
I have several modules that use large tables to generate code and other tables, etc. Usually, these tables look like this:
These can go several levels deep. The problem I've run into is that I like the arrow notation, as it makes the tables easy and intuitive to read. However, since I use constants and left side of the arrow is placed in quotes, I have to call the constant explicitly, using ampersand.use constant SOME_TABLE => { &SOMECONSTANT => [ &ANOTHER1 => sub { ... }, &CONST2 => sub { ... }, ], ....... };
The problem with this is that if such constant is undefined (due to a type-o, for instance), this error will not get caught until run-time. It would be neat to catch these bastards at compile-time, but then I have to lose the arrow and use a comma instead.
Question: is there a way to catch undefined subroutines at compile-time and keep using the arrow notation at the same time?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Constants and arrow notation.
by davido (Cardinal) on Oct 28, 2004 at 18:45 UTC | |
by dmitri (Priest) on Oct 28, 2004 at 18:51 UTC | |
|
Re: Constants and arrow notation.
by samtregar (Abbot) on Oct 28, 2004 at 18:35 UTC | |
|
Re: Constants and arrow notation.
by perrin (Chancellor) on Oct 28, 2004 at 18:41 UTC | |
by pg (Canon) on Oct 28, 2004 at 21:09 UTC |