Debugger question

Discussion in 'Perl Misc' started by Derek Goto, Aug 25, 2003.

  1. Derek Goto

    Derek Goto Guest

    I was running the perl debugger with arguments "-d -e 1" to test a small
    program. When I assigned a value to the variable $foo, I could use it
    fine, but when I qualified $bar with my, it remained undefined. Same
    with local. Why is this? Does the debugger operate in a different scope
    than main? If so, shouldn't I be able to access those values anyway? I
    could access the value of $bar from the debugger when it was assigned
    within in a script, but I couldn't successfully modify it. What's going
    on here?
     
    Derek Goto, Aug 25, 2003
    #1
    1. Advertising

  2. -----BEGIN PGP SIGNED MESSAGE-----
    Hash: SHA1

    Derek Goto <> wrote in
    news::

    > I was running the perl debugger with arguments "-d -e 1" to test a small
    > program. When I assigned a value to the variable $foo, I could use it
    > fine, but when I qualified $bar with my, it remained undefined. Same
    > with local. Why is this? Does the debugger operate in a different scope
    > than main? If so, shouldn't I be able to access those values anyway? I
    > could access the value of $bar from the debugger when it was assigned
    > within in a script, but I couldn't successfully modify it. What's going
    > on here?


    It's a limitation inherent in the debugger.

    Each expression you enter at the debugger prompt is evaluated in its own
    scope. When the expression is finished, the scope goes away. Your
    assignment to "my $bar" works, but at the end of the scope $bar goes away,
    and when you next type "p $bar" or "x $bar", it's not there any more.

    - --
    Eric
    $_ = reverse sort $ /. r , qw p ekca lre uJ reh
    ts p , map $ _. $ " , qw e p h tona e and print

    -----BEGIN PGP SIGNATURE-----
    Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

    iQA/AwUBP0ndXGPeouIeTNHoEQKkKQCgzYi+ib0msMI/h4p7uLRW7QMdBhUAn1H+
    YHV9TXERaOGVzxlbdLX6gQIb
    =wA5Q
    -----END PGP SIGNATURE-----
     
    Eric J. Roode, Aug 25, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Derek Goto

    Debugger question

    Derek Goto, Aug 25, 2003, in forum: Perl
    Replies:
    1
    Views:
    982
    Eric J. Roode
    Aug 25, 2003
  2. Philip Townsend

    asp.net debugger question

    Philip Townsend, Dec 5, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    392
    Jason S
    Dec 5, 2003
  3. Richard C. Eberhardt

    NetBeans Debugger Question

    Richard C. Eberhardt, Jul 19, 2003, in forum: Java
    Replies:
    0
    Views:
    400
    Richard C. Eberhardt
    Jul 19, 2003
  4. Robert Oschler
    Replies:
    1
    Views:
    225
    Mcginkel
    Sep 5, 2005
  5. aflat362
    Replies:
    7
    Views:
    221
    naixn
    Dec 7, 2006
Loading...

Share This Page