in reply to Perl try { } catch(e) { }
Have you looked at how Try::Tiny does its thing. Most likely, you can reuse that code for your implementation.
Note that catch(e) is invalid syntax in Perl (unless you declare a parameterless function e()). Resorting to something like catch my $e { is not allowed by Perl syntax either, because the & prototype works its syntactical magic only when it is the first prototype character.
You could use something like
catch { my $e= $@; ... }
... if you really want to rename $@.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Perl try { } catch(e) { }
by Superfox il Volpone (Sexton) on Mar 03, 2015 at 15:18 UTC | |
by Anonymous Monk on Mar 03, 2015 at 15:29 UTC | |
by karlgoethebier (Abbot) on Mar 03, 2015 at 17:39 UTC | |
by jdeguest (Beadle) on Mar 24, 2021 at 03:29 UTC | |
by haukex (Archbishop) on Mar 24, 2021 at 08:51 UTC | |
by jdeguest (Beadle) on Jun 17, 2021 at 02:47 UTC | |
| |
by karlgoethebier (Abbot) on Mar 24, 2021 at 21:44 UTC |