Well you could toy around with source filters.  A source filter allows you
to manipulate your code after it is read into memory but before it is
executed.

Here is a good article on it, and even has an example of handling debug
output.

http://www.samag.com/documents/s=1287/sam03030004/

You could do pretty much whatever you wanted with it, like writing a filter
that searched the text of your code for "sub ...", and then added a line
under it that printed out the sub name as well as @_ to STDERR.  ...Anyway,
it's a powerful mechanism that can easily be turned off when you want to
move the code to production.

Rob

-----Original Message-----
From: David T-G [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 07, 2002 8:32 AM
To: perl beginners
Subject: debugging statements and such


Hi, all --

The recent post containing print statements "this is one" and so on
reminded me of an old question that I've never had answered: what's a
good way to trace your program as it runs, preferably without getting
into the debugger?

I realize that that's sort of a loaded question and that the obvious right
answer, promoted by power perlers everywhere, is to use the debugger.
But I don't know how to use the sucker, haven't gotten far learning it
(and my forehead now hurts from all of the banging), and all I really
want is the equivalent of "set -x" under sh so that I can see the steps
that were taken and follow the progress in the output.

I saw a clever trick where a fellow prefixed his debugging output with
more and more '-' signs the deeper he was into subroutines (obviously not
a good approach for recursion :-) but he wouldn't tell me how he did it.
Bugger.

Somewhere between the one side of the ubiquitous print statements, which
can be difficult to clean out and pretty up when debugging is done,
and the other side of the debugger, with all of its arcanity, is there
a good middle ground for debugging and progress tracking?


TIA & HAND

:-D
-- 
David T-G                      * It's easier to fight for one's principles
(play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie
(work) [EMAIL PROTECTED]
http://www.justpickone.org/davidtg/    Shpx gur Pbzzhavpngvbaf Qrprapl Npg!


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to