[Chicago-talk] Dec Tech mtg...

Steven Lembark lembark at wrkhors.com
Fri Nov 28 15:22:42 CST 2003

-- "Young, Aaron" <Aaron.Young at citadelgroup.com>

> another thing that might be useful in the debugger is how to extend it
> to do some things that it cannot currently do
> this might be out of the scope of your presentation, but some other
> command line debuggers have a way of remembering the command line passed
> in, how could this be emulated in the perl debugger, or added on?

	$ perl -d foo --bar --bletch=blort;

	DB<1> @a = @ARGV


	DB<99> @ARGV = @a;

I'm currently on 5.8.2, and the R (restart) operator resets
@ARGV for itself:

$ perl -d hak --foo --bar=foo /bin/ls

  DB<1> x @ARGV
  0  '--foo'
  1  '--bar=foo'
  2  '/bin/ls'

  DB<2> c


  Debugged program terminated.  Use q to quit or R to restart,
  use O inhibit_exit to avoid stopping after program termination,
  h q, h R or h O to get additional info.
  DB<2> x @ARGV
  0  '/bin/ls'

  DB<4> R

  DB<2> x @ARGV
  0  '--foo'
  1  '--bar=foo'
  2  '/bin/ls'

Blanking @ARGV in the debugger doesn't cause problems for the
restart either:

	DB<8> @ARGV = ()

	DB<9> R
	Warning: some settings and command-line options may be lost!

	Loading DB routines from perl5db.pl version 1.22
	Editor support available.

	Enter h or `h h' for help, or `man perldebug' for more help.

	main::(hak:3):  our @argv = @ARGV unless @argv;
	DB<8> x @ARGV
	0  '--foo'
	1  '--bar=foo'
	2  '/bin/ls'

Net result is that running the thing once then using "R"
does a restart with @ARGV populated with the original values.

Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508

More information about the Chicago-talk mailing list