|There's more than one way to do things|
defining constant in other packageby LanX (Bishop)
|on Apr 24, 2012 at 14:20 UTC||Need Help??|
LanX has asked for the
wisdom of the Perl Monks concerning the following question:
For a package which I'm coding I wanna offer to switch on debugging by a constant!
The idea is that the related code is not compiled if the flag is false (codefolding)¹ thus not causing performance lost if in non-debug mode.
Is there any way to tell use constant which namespace to use?
ATM I'm using something like
Any nicer way to achieve this?
UPDATE: at least it can be simplified for the user with lexically scoped packages:
UPDATE: ¹) better phrased as "unreachable code removal"