in reply to change 'use constant' value through commandline arguments?

How about using an environmental variable?

use constant DEBUGGING => $ENV{DEBUGGING} || 0;
Otherwise, you'll have to wrap your @ARGV processing in a BEGIN {} block so it will run at compile time. That's when (and how) use statements run.

Replies are listed 'Best First'.
•Re: Re: change 'use constant' value through commandline arguments?
by merlyn (Sage) on Mar 14, 2002 at 20:16 UTC
    How about using an environmental variable?
    There's no such thing as "environmental" variable, unless you're talking about $greenpeace, or something. It's "environment" variable.

    There must be some very common document that a lot of people read to get this wrong, that came out about three or four years ago. Nobody got it wrong before that. {sigh}

    -- Randal L. Schwartz, Perl hacker

      Alternate possibility: everybody who gets it wrong does so before 8 am, when their brain and fingers are not on speaking terms. :)
Re: Re: change 'use constant' value through commandline arguments?
by neuroball (Pilgrim) on Mar 14, 2002 at 16:42 UTC
    The implementation of an environment variable is kind of a bit more work than I planned for a debug switch... but something to think about.

    Btw. thanks for the BEGIN/use education... even though the outcome is the same... DEBUGGING is always 1.