Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Accessing DEBUG constant from sub-package

by tobyink (Canon)
on Aug 10, 2013 at 07:06 UTC ( #1048883=note: print w/replies, xml ) Need Help??


in reply to Accessing DEBUG constant from sub-package

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.

package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1048883]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2022-01-27 17:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (71 votes). Check out past polls.

    Notices?