Re: How to check if a DateTime is invalid (again - but this time without using eval)?
[email protected] (Thomas Klausner) Mon, 3 Jul 2017 17:11:18 +0200
| Newsgroups | perl.datetime |
|---|---|
| Message-ID | <[email protected]> |
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 more backgroud:
block eval indeed had some not-totally-implausible corner cases, as
listed here:
https://metacpan.org/pod/Try::Tiny#BACKGROUND
AFAIK at least some of them were fixed in Perl 5.14:
http://blog.twoshortplanks.com/2011/06/06/unexceptional-exceptions-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...
Greetings,
domm
--
#!/usr/bin/perl http://domm.plix.at
for(ref bless{},just'another'perl'hacker){s-:+-$"-g&&print$_.$/}