Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Debugging in packages

by TheoPetersen (Priest)
on Jul 17, 2001 at 17:30 UTC ( #97307=note: print w/replies, xml ) Need Help??


in reply to Debugging in packages

There's nothing terribly wrong with this approach, and it's the typical first step along the way to more complicated debugging schemes. Once the script is working you'll probably go on to set the debug flag from an environment variable or command line option as I did.

The reason for other recommendations is that this scheme makes debugging an all or nothing mechanism. When I was working on a very complex system with many classes, I needed a way to get run-time information from the classes of interest, without clogging output completely with the full range of feedback I'd coded into the system. For that I used an initialization that parsed out which classes should spit out run-time information, then went on the specialize it more so that the instances associated with certain tables would have debugging on, while others were off.

One disadvantage to using a global variable is that it is prone to typos. If your code refers to $main::DEBYG somewhere you'll have to catch it yourself; it's a valid variable name.

Also, you can shorten your modifiers:

if $self->{DEBUG}
rather than
if ($self->{DEBUG})
unless you just prefer the way the parenthesis look.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://97307]
help
Chatterbox?
[Corion]: thezip: Yeah - we have "CAP", but that means "Change Ablauf Plan" (Change Sequence Plan). Likely there is a true ITIL name for this too.
[Corion]: While I'm not really a fan of ITIL, it certainly is better than nothing and it at least provides a common vocabulary, so if you have ITIL somewhere at your disposal, it might be worth a look
[Corion]: Hmm - that should be somewhere in the "Release Deployment Plan", but I don't find a good English link (nor a good German one ;) )

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2017-02-23 17:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Before electricity was invented, what was the Electric Eel called?






    Results (350 votes). Check out past polls.