in reply to Debugging in packages

You can do something like:

package My::WunderCode; BEGIN { if( $ENV{DEBUG_MY_WUNDERCODE} ) { eval "sub debug() { !1 }"; } else { eval "sub debug() { 1 }"; } die $@ if $@; } warn "Debugging ",__PACKAGE__,"...\n" if debug;
and Perl will optimize away your debug code when it is compiled if debugging is not enabled. Just another way...

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Debugging in packages
by RayRay459 (Pilgrim) on Jul 18, 2001 at 01:36 UTC
    Question... I am new to perl(about a month or so) and i have finished the Learning Perl for Win32...where else, in your opinion, should i go to further my learning for perl in retrospect to being able to apply it on my NT/2k machines. I bought "Windows NT - Win32 Perl Programming: The Standard Extensions" and it is a little more advanced in programming. Maybe i guess...i am looking for...something that will keep going in progression...kinda like how the Learning Perl book does...learn a little something new and test my knowledge on it with everything that i previously learned as well. I am able to apply scripts that i find or other people provide for me as examples by tweeking them, but i probably would not be able to get there by myself. Does that make sense? This may be a lot of jarble..but since you do program for NT/2k environment, i figured you would be a good person to ask. Any advice would be much appreciated. As i am always open to listen. thnx ~Ray