zude has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I'm trying to do some exception handling similar to:
$SIG{__DIE__}=sub{$^S and return; print("DIED: ",@_); exit }; eval { die "cya!\n" }; $@ and die "outside: ",$@;
I expect this to produce "DIED: outside: cya!", and with perl 5.8 this is exactly what happens.

However perl 5.6 only gives "outside: cya!". Further hacking shows that the $^S variable is still set when eval exits (and trying to force $^S to 0 is runtime error).

Problem is that this needs to go into production environment with perl 5.6 (RH7.3 distro). Is there a workaround for this bug in 5.6?

Or, any information on installing 5.8 in tandem with existing 5.6 without exploding anything? :)

Thanks for your help.

--------
~%{${@_[0]}}->{0}&&+++ NO CARRIER

Replies are listed 'Best First'.
Re: Perl 5.6 exception problem
by dragonchild (Archbishop) on Aug 20, 2004 at 18:26 UTC
    Installing multiple Perls is easy. You just have to make sure that each binary is called something different. I often have 2-3 Perls installed on development machines. /usr/bin/perl and /usr/local/bin/perl are almost always different versions. (I don't like vendor-builds much.) You can also do /usr/local/bin/perl5.6.2 and /usr/local/bin/perl5.8.0, if you want. (This is what gcc does ...)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

    I shouldn't have to say this, but any code, unless otherwise stated, is untested

      Which you do with Configure -Dversiononly. (That has the side effect of clearing inc_version_list/inc_version_list_init, so you may want to set those in config.sh after configuring and then rerun Configurure -S or config_h.SH if you are trying to have e.g. 5.8.2 and 5.8.5 separate, but have 5.8.5 use 5.8.2's installed modules. This is not an issue for using both 5.6.x and 5.8.x.)