On Thu, 2004-03-11 at 05:20, Orton, Yves wrote:

> use constant ARG1=>$ARGV[0];
>
> is better 

Absolutely.  the begin block posting was a hurried and untested
example of how to use a BEGIN block.  By the time people subscribe
to module-authors you'd think they would know how to use a BEGIN
block to evalueate some parts of their program before the rest of
it.  I suspect that since @ARGV is set before any compiling happens,
a bign block might not actually be needed in that case at all.  A
better example would have had a complex startup phase entirely
within the BEGIN block, and the last thing in the BEGIN block is,
to establish the 'constants' through whatever mechanism is appropriate,
such as reading the rest of the source code through a source filter
that replaces the 'constants' with their values, in single quotes,
rather than making Perl compile and optimize.  For that matter, the
source filter could output ANSI C and pass it to yor compiler.  Somebody
give me a grant!


Reply via email to