develooper Front page | perl.datetime | Postings from July 2017

Re: How to check if a DateTime is invalid (again - but this timewithout using eval)?

Thread Previous | Thread Next
From:
Binarus
Date:
July 6, 2017 06:49
Subject:
Re: How to check if a DateTime is invalid (again - but this timewithout using eval)?
Message ID:
c09c4e0b-a3c6-0292-b1f3-2fecc97b069d@binarus.de
On 05.07.2017 18:27, Bill Moseley wrote:
> Haven't those issues with eval been addressed in more recent versions of
> Perl?  
> 
> For example, in older Perls this used to reset $@, but now $@ is retained:
> 
> use strict;
> use warnings;
> 
>     sub Foo::DESTROY {
>         print "in Foo Destroy\n";
>         eval { 1 };
>         print "Foo has \$@ as '$@'\n"
>         return;
>     }
> 
>     eval {
>         my $foo = bless {}, 'Foo';
>         die "BOOM\n";
>     };
>     print "eval with $@\n";
> 
> 
> Returns:
> 
>     in Foo Destroy
>     Foo has $@ as ''
>     eval with BOOM
> 

Thomas Klausner in one of his posts provided the following link:
http://blog.twoshortplanks.com/2011/06/06/unexceptional-exceptions-in-perl-5-14/

From reading it, I have got the impression that the behavior in 5.14 has
been drastically improved, but that not all problems are solved. I have
to re-read, though (being new to exception handling in Perl).

Thanks for your help!

Regards,

Binarus

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About