nbokare has asked for the wisdom of the Perl Monks concerning the following question:
I'm testing an eval block. I want to imitate a situation in debug mode and for that I want to change $@ in debug mode to a different value. But the value in $@ does not seem to be changing.
Take a look at the following debug session:
> perl -d -e ' eval { 1/0}; print $@; $@ = "nikhil"; print $@' Loading DB routines from perl5db.pl version 1.32 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): eval { 1/0}; print $@; $@ = "nikhil"; print $@ DB<1> DB<1> n main::(-e:1): eval { 1/0}; print $@; $@ = "nikhil"; print $@ DB<1> n main::(-e:1): eval { 1/0}; print $@; $@ = "nikhil"; print $@ DB<1> n Illegal division by zero at -e line 1. main::(-e:1): eval { 1/0}; print $@; $@ = "nikhil"; print $@ DB<1> x $@ 0 'Illegal division by zero at -e line 1. ' DB<2> $@ = "a" DB<3> x $@ 0 'Illegal division by zero at -e line 1. ' DB<4> n main::(-e:1): eval { 1/0}; print $@; $@ = "nikhil"; print $@ DB<4> x $@ 0 'nikhil' DB<5>
I'm able to set $@ programmatically from the script but not in the debug shell. Is this a known perl feature/issue?
Please enlighten me.
Thanks,
Nikhil
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Changing $@ in debug mode
by Corion (Patriarch) on Dec 02, 2010 at 12:53 UTC | |
by nbokare (Novice) on Dec 02, 2010 at 12:58 UTC | |
|
Re: Changing $@ in debug mode
by locked_user sundialsvc4 (Abbot) on Dec 02, 2010 at 13:44 UTC | |
by nbokare (Novice) on Dec 02, 2010 at 15:26 UTC | |
|
Re: Changing $@ in debug mode
by pemungkah (Priest) on Dec 03, 2010 at 00:16 UTC |