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:
Thomas Klausner
Date:
July 2, 2017 17:01
Subject:
Re: How to check if a DateTime is invalid (again - but this timewithout using eval)?
Message ID:
20170702170136.2s4wqs5meyy5uzyx@plix.at
Hi!

On Sun, Jul 02, 2017 at 11:59:56AM +0200, Binarus wrote:

> - Most people recommend to "catch the error" DateTime throws when
> encountering such date-times, but if I got it right, that always
> involves eval, even when using modules like Try:Tiny and the like, so I
> don't want to do that.

As somebody who most likely started on of the threads you mentioned, I 
have to say that using eval is (as Zefram already said) the right 
answer.

I do not know why you do not want to use eval, it's very stable 
(esp. in recent Perls) and not at all slow and dangerous. 

Greetings,
domm


-- 
#!/usr/bin/perl                              http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}

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