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

2017-07-03 Thread Zefram
Eric Brine wrote: >On Mon, Jul 3, 2017 at 11:11 AM, Thomas Klausner wrote: >> I personally don't like Try::Tiny, because it changes how 'return' works >> inside an eval (well, try) > >What difference is there? I think domm is actually thinking of TryCatch there. Inside an eval,

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

2017-07-03 Thread Eric Brine
On Mon, Jul 3, 2017 at 11:11 AM, Thomas Klausner wrote: > I personally don't like Try::Tiny, because it changes how 'return' works > inside an eval (well, try) What difference is there?

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

2017-07-03 Thread Thomas Klausner
Hi! 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

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

2017-07-03 Thread Rick Measham
On 3/07/2017 17:44, Binarus wrote: This answer has 49 upvotes, so can't be too wrong. Oh no, this is the internet. That's likely 49 other people don't know the answer, but want to look smart. - Rick -- Message protected for iSite by MailGuard: e-mail anti-virus, anti-spam and content

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

2017-07-03 Thread Rick Measham
I'm not sure what you mean by 'local DIE handlers'. Are you talking about defining a local $SIG{__DIE__} ? I've been out of perl for a couple of years, but surely you should just use eval{} ? $dt = eval { $parser->parse( $input );}; if( $@ ){ echo "Unable to parse your date

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

2017-07-03 Thread Binarus
On 03.07.2017 05:57, Bill Ricker wrote: > Unpacking it a little ...​ > > ​1. Scalar Eval​ > [...] > > 2. Block Eval > [...] > > 3. Try-Catch > [...] > Thank you very much for your elaborated and understandable answer. My main problem was that from my readings I got the impression that even

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

2017-07-03 Thread Binarus
On 02.07.2017 22:02, Eric Brine wrote: > `eval BLOCK` is very different `eval EXPR`. > > The latter involves the need to generate Perl code, and ask the related > risks. That's not the case for the former, which is the right tool for > the job here. > Thank you very much for your answer. I

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

2017-07-03 Thread Binarus
On 02.07.2017 19:01, Thomas Klausner wrote: > 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

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

2017-07-03 Thread Binarus
On 02.07.2017 12:24, Zefram wrote: > 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. > > Do