When debugging Perl how to reissue repetitive debugging commands? 
Author Message
 When debugging Perl how to reissue repetitive debugging commands?

Being the lousy programmer that I am, I find myself repeatedly debugging the
same Perl script .  It is often the case that as I start a debugging
session, I enter the same list of breakpoints before really starting the
code up.  Is there a way to either tell the Perl de{*filter*} to read a
particular file for commands or to setup a shell script that starts the
de{*filter*} and issues the initial set of debugging commands before dropping
back to listening to STDIN for more commands.  So far I have not been able
to figure out a way to do this.  I am thinking that .perldb might do the
trick, but 1) I am concerned that .perldb is executed before my script is
loaded and 2) I can't readily maintain different debug startup commands for
different Perl scripts.

TIA,

Marty Packer
<insert cute quotation here>



Tue, 24 Feb 2004 09:34:10 GMT  
 When debugging Perl how to reissue repetitive debugging commands?

Quote:

> It is often the case that as I start a debugging
> session, I enter the same list of breakpoints before really starting the
> code up.

Assuming it's the *exact* same text each time, you could put
it all in a text file, and cut-and-paste it from an editor
window into your de{*filter*}'s terminal window.

--
John Porter



Tue, 24 Feb 2004 19:35:44 GMT  
 When debugging Perl how to reissue repetitive debugging commands?

Quote:

>Expect is a wonderful tool for automating interactive programs - you
>can probably do what you need to with three or four commands from
>that.

>http://expect.nist.gov/

>(not a very perlish answer, oops!)

There is an Expect module on CPAN, it has the same interface as the
expect program, but Perl rather than Tcl.

--

Finger for PGP key



Tue, 24 Feb 2004 20:48:04 GMT  
 When debugging Perl how to reissue repetitive debugging commands?

Quote:

> Being the lousy programmer that I am, I find myself repeatedly debugging
> the
> same Perl script .  It is often the case that as I start a debugging
> session, I enter the same list of breakpoints before really starting the
> code up.  Is there a way to either tell the Perl de{*filter*} to read a
> particular file for commands or to setup a shell script that starts the
> de{*filter*} and issues the initial set of debugging commands before dropping
> back to listening to STDIN for more commands.  So far I have not been able
> to figure out a way to do this.  I am thinking that .perldb might do the
> trick, but 1) I am concerned that .perldb is executed before my script is
> loaded and 2) I can't readily maintain different debug startup commands
> for different Perl scripts.

Your .perldb could read lists of breakpoints and set them (it's just Perl
code).

But what may be easier is to just put the breakpoints in your source:

$DB::single = 1;        # set a breakpoint

You can even make them conditional this way.



Mon, 23 Feb 2004 18:54:14 GMT  
 When debugging Perl how to reissue repetitive debugging commands?

Quote:

> Being the lousy programmer that I am, I find myself repeatedly debugging
> the same Perl script .  It is often the case that as I start a debugging
> session, I enter the same list of breakpoints before really starting the
> code up.

Simple suggestion: how about never quitting the perl process (suspend it if
you need to), and just running the script again by the R command? That will
keep the breakpoints as they are, and will also reload the script (and any
modules), taking into account any changes you made.

Sam
--
Home page: http://www.illuminated.co.uk/
Convert ZIPs to Mac format: http://www.illuminated.co.uk/macifyzip/
In Nomine Cookbook: http://www.illuminated.co.uk/innomine/
Hofstadter's Law: It always takes longer than you think it will take, even
if you take into account Hofstadter's Law



Wed, 25 Feb 2004 05:24:55 GMT  
 When debugging Perl how to reissue repetitive debugging commands?

s:

Quote:
> MP> Being the lousy programmer that I am, I find myself repeatedly debugging
> the
> MP> same Perl script .  It is often the case that as I start a debugging
> MP> session, I enter the same list of breakpoints before really starting the
> MP> code up.  Is there a way to either tell the Perl de{*filter*} to read a
> MP> particular file for commands or to setup a shell script that starts the
> MP> de{*filter*} and issues the initial set of debugging commands before dropping
> MP> back to listening to STDIN for more commands.  So far I have not been abl
> e
> MP> to figure out a way to do this.  I am thinking that .perldb might do the
> MP> trick, but 1) I am concerned that .perldb is executed before my script is
> MP> loaded and 2) I can't readily maintain different debug startup commands f
> or
> MP> different Perl scripts.

> i can't say i've used the perl de{*filter*} much (if at all), so i don't
> know if it's got built-in support for that sort of thing.

> however, Expect is a wonderful tool for automating interactive
> programs - you can probably do what you need to with three or four
> commands from that.

> http://www.*-*-*.com/

> (not a very perlish answer, oops!)

Another answer if you are on Windows or Unix with X or something similar is
to use Devel::ptkdb.  It's a graphical de{*filter*} for perl (perl -d:ptkdb
script) that allows you to save script-specific config files.


Wed, 25 Feb 2004 04:12:02 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Stumped - BASM far indirect call

2. RTE-200 Terror

3. debug code with system command exec other perl files

4. Debug .pl Syntax of command line args ?

5. Command Line Debug of CGI.pm program when a file upload is involved

6. Continuous printing on tractor from windows?

7. Can someone help me with this procedure?

8. using dll with freepascal

9. Debugging Perl and extensions (Perl gurus please help)

10. Help debugging odd Perl + Perl module interaction

11. Debug a forked/exec Perl script started from another Perl script

12. Need an idea to do Perl-debugging in embedded Perl

 

 
Powered by phpBB® Forum Software