develooper Front page | perl.perl5.porters | Postings from July 2020

Re: Exceptions thrown from LEAVE

Thread Previous | Thread Next
Paul "LeoNerd" Evans
July 7, 2020 22:29
Re: Exceptions thrown from LEAVE
Message ID:
On Tue, 7 Jul 2020 20:43:40 +0200
Christian Millour <> wrote:

> You would need a way to access this stack/history in a catch block,
> and maybe to cook it if you dealt with some of the reported issues
> but have to rethrow the exception (with its cooked history) to
> another agent up the ladder to deal with the rest. System support
> would be needed for error raised in system destructors (e.g.
> automatic closing of lexical filehandles).
> I have no clue as to whether this is doable, even with an EV. Might
> be nice though.

Well, indeed that was most of the point of having a new,
natively-recognised representation type for exception values like this.
Once core understands them, it can indeed annotate such extra
information on. It becomes a simple matter of maybe

  catch ($e) {
    warn "something happened...";
    if(my $caused_by = $e->caused_by) {
      warn "which itself was caused by ...";

Paul "LeoNerd" Evans      |  |

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About