in reply to Re: perl -d at runtime?
in thread perl -d at runtime?

Reworking davido's idea above:
if ( ( do_I_want_debug ) and ( not defined( $DB::VERSION ) ) # already in debug? { exec('perl -d $0 @ARGV') or die $!; }
I can't remember the variable to check if the debugger is running. $DEBUGGING used to work, but not here on ActiveState 5.8.0.

-QM
--
Quantum Mechanics: The dreams stuff is made of

Replies are listed 'Best First'.
Re: Re: Re: perl -d at runtime?
by bsb (Priest) on Dec 22, 2003 at 08:03 UTC
    I ended up stripping the -d arg and using exec.
    #!/usr/bin/perl -w BEGIN { # handle -d by itself to start the debugger @ARGV = grep { $_ eq '-d' ? !($opt_d=1) : 1 } @ARGV; exec('/usr/bin/perl','-dS',$0,@ARGV) if $opt_d; } ...
    Note that this doesn't do clustering like smarter switch process.

    Also, I don't know if I need that -S but it's not hurting yet.