Personally I'd do something like this in the Thing package:
use constant DEBUG => main->can("DEBUG") && main->DEBUG;
This makes your Thing package more re-usable, allowing it to be used in scripts that don't define a DEBUG constant in the main package.
In reply to Re: Accessing DEBUG constant from sub-package
by tobyink
in thread Accessing DEBUG constant from sub-package
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |