Skip to Content
Perl Debugged
book

Perl Debugged

by Peter Scott, Ed Wright
March 2001
Intermediate to advanced
288 pages
4h 56m
English
Addison-Wesley Professional
Content preview from Perl Debugged

5.2. Making it Optional

After typing in a tracing statement, taking it out after the code is “working,” then putting it back in when the code mysteriously stops working, you're motivated to find a way to leave it in there and selectively enable it.

The most primitive way is to comment it out, but since there are no independently compiled binary executables for Perl programs,[4] this isn't as bad a solution as it would be for, say, C—you'd have to rebuild the executable and have a way of knowing whether it was in sync with the source. Just make sure that if your print statement exceeds one line, you comment/uncomment all the lines.

[4] With a few qualification-ridden exceptions.

The next most basic option is to create a program-wide Boolean variable ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Perl Hacks

Perl Hacks

Chromatic, Damian Conway, Curtis Ovid Poe, Curtis (Ovid) Poe
Pro Perl

Pro Perl

Peter Wainwright
Intermediate Perl

Intermediate Perl

Randal L. Schwartz, brian d foy, Tom Phoenix
Perl Testing: A Developer's Notebook

Perl Testing: A Developer's Notebook

Ian Langworth, Chromatic

Publisher Resources

ISBN: 0201700549Purchase book