SPUG: Debugging methodology (was: How to deal with same name packages?)
Michael R. Wolf
MichaelRunningWolf at att.net
Sat Jan 26 08:53:32 CST 2002
"Richard Anderson" <richard at richard-anderson.org> writes:
> use MyClass;
> $MyClass::Debug = 1; # or 2 or 3
> $MyClass::DoSomething();
>
> and in MyClass:
>
> if (Debug > 0) {
> print (whatever)
> }
I, too, use statements like this, but format them as follows:
print STDERR "Debug/Assertion statement" if $debug;
or
print STDERR "Debug/Assertion statement" if $debug > 1;
The reason I like this is that it reads as an assertion
comment for casual human readers, but runs like an if
statement.
--
Michael R. Wolf
All mammals learn by playing!
MichaelRunningWolf at att.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/
More information about the spug-list
mailing list