On Friday, June 21, 2002, at 09:27 , Harry Putnam wrote:

> Sometimes I'd like to run a perl program in a similar way as one can
> run a shell script with the -x switch.  Where all commands and
> actions are printed to tty as the occur.

that is in essence the Shell Debugger.

Which really is not a 'realDebugger[tm]' because it really
does not allow you to step your way through the code - and all
the other wonderful things we love to do with realDebuggers[tm]'.

> How does one simulate that with perl? I suspect it may be the -d flag
> (debug) but I have no experience at all with that.  It looks a lot
> more complicated than the sh -x flag.

You are stepping off in the right direction - since

        perldoc perldebug

will introduce you to the basics of the Perl Debugger,
which is really want you want here.

Gaining some 'experience' with it is best done on small things
and move up the game a step or two...

Some will advocate

        use diagnostics

cf perldoc diagnostics

But I think that getting your feet wet and feeling at home with
the debugger will be better in the long run...

>  I could stick lots of `prints'
> int there, but isn't there a way to simulate -x?

This is where we all start and really shouldn't - but we all
do it - because at times it is 'simpler' to do. In this space
I normally do the gambit of

        my $debug = 0;

.....
        print "Some Skank here" if $debug ;

and then flip that on or off....

The fun of course is the copy that file and remove all lines
where there is the token $debug - and find out that my prints
have been safe guarding me against some horror....



ciao
drieux

---


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

Reply via email to