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
In reply to Changing $@ in debug mode by nbokare
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |