in reply to Re: Exception handling (alternatives)
in thread Exception handling (alternatives)

Great suggestion there! ;-).

I'll take a look. I sort of suspected that there should have been something to help me out in that case (to eliminate the need of using 'sub' word).



"There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith
  • Comment on Re: Re: Exception handling (alternatives)

Replies are listed 'Best First'.
Re: Re: Re: Exception handling (alternatives)
by vladb (Vicar) on Dec 21, 2001 at 19:51 UTC
    Here's what I've been able to dig up by running perldoc perlsub. This piece of code is exactly to the point in my case. Again, thanks for pointing me in the right direction! ;-) cheers.
    sub try (&@) { my($try,$catch) = @_; eval { &$try }; if ($@) { local $_ = $@; &$catch; } } sub catch (&) { $_[0] } try { die "phooey"; } catch { /phooey/ and print "unphooey\n"; };


    "There is no system but GNU, and Linux is one of its kernels." -- Confession of Faith