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
Thomas Klausner
July 3, 2017 15:11
Re: How to check if a DateTime is invalid (again - but this timewithout using eval)?
Message ID:

On Mon, Jul 03, 2017 at 10:00:52AM +0200, Binarus wrote:
> My main problem was that from my readings I got the impression that even
> the block eval might be problematic (please see my answer to Thomas
> Klausner's first post if you are interested what made me believe so).

Just for a bit more backgroud:

block eval indeed had some not-totally-implausible corner cases, as 
listed here:

AFAIK at least some of them were fixed in Perl 5.14:

I personally don't like Try::Tiny, because it changes how 'return' works 
inside an eval (well, try), and I'm too stupid to remember this change 
(and it bit me a few times). OTOH I never (even on ancient Perls had any 
problem with three issues mentioned in Try::Tiny - Background (but then 
"die Dummen hams Gl├╝ck" as a local saying goes)

And regarding using exceptions or not: I don't think you have a choice 
here. You will always encounter exceptions (disk full, DB-Server 
crashed, ...), so you might as well get used to them and incorporate 
them in your toolkit. I know nothing about .NET, so maybe exceptions are 
horrible there. But in Perl they work quite well, IMO...


for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

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