For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > December 2004 > Debugger question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Debugger question
Red King

2004-12-20, 8:57 am

Hi,

There is a script that "uses" a couple of modules and one of those
modules is setting an environmental variable. I need to determine
which of the used modules is doing that. Could someone let me know how
I should use the debugger to find this?

That is, script.pl does something like:

use ModuleA;
use ModuleB;
use ModuleC;
use ModuleD;

I need to determine whether it is ModuleA or ModuleB or ModuleC or
ModuleD which is setting an environmental variable FOO?

I looked at "man perldebug" but couldn't deduce anything useful.

Thanks in advance,
Amit
Peter Scott

2004-12-20, 3:56 pm

In article <bd837f8e04122001334c809d9b@mail.gmail.com>,
redcodemonk@gmail.com (Red King) writes:
>There is a script that "uses" a couple of modules and one of those
>modules is setting an environmental variable. I need to determine
>which of the used modules is doing that. Could someone let me know how
>I should use the debugger to find this?
>
>That is, script.pl does something like:
>
>use ModuleA;
>use ModuleB;
>use ModuleC;
>use ModuleD;
>
>I need to determine whether it is ModuleA or ModuleB or ModuleC or
>ModuleD which is setting an environmental variable FOO?


Insert the line

BEGIN { $DB::single = 1 }

before those use statements and run under the debugger.

You should be able to set a watchpoint on $ENV{WHATEVER} to
make the search go faster.

--
Peter Scott
http://www.perldebugged.com/
*** NEW *** http://www.perlmedic.com/
Red King

2004-12-21, 3:55 am

Thanks Peter! That solved my problem.

Regards,
Amit


On 20 Dec 2004 16:36:27 -0000, Peter Scott <peter@psdt.com> wrote:
> In article <bd837f8e04122001334c809d9b@mail.gmail.com>,
> redcodemonk@gmail.com (Red King) writes:
>
> Insert the line
>
> BEGIN { $DB::single = 1 }
>
> before those use statements and run under the debugger.
>
> You should be able to set a watchpoint on $ENV{WHATEVER} to
> make the search go faster.
>
> --
> Peter Scott
> http://www.perldebugged.com/
> *** NEW *** http://www.perlmedic.com/
>
> --
> To unsubscribe, e-mail: beginners-unsubscribe@perl.org
> For additional commands, e-mail: beginners-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com