good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: The "right" way to make your script run with old versions of perlby haukex (Archbishop) |
on Jun 08, 2016 at 15:59 UTC ( [id://1165156]=note: print w/replies, xml ) | Need Help?? |
Hi xorl, The other solutions so far by Athanasius, Corion and MidLifeXis are cleaner and easier to maintain, and I would also suggest wrapping the functionality in a module that abstracts your Cool modules. But just for completeness, here's one way to directly implement the code you've shown (
You don't even have to make the conditions dependent on the versions, you can just try to use several modules and take whichever one is available. And a note on $]: When comparing $], string comparison operators are highly recommended. The inherent limitations of binary floating point representation can sometimes lead to incorrect comparisons for some numbers on some architectures. Hope this helps,
In Section
Seekers of Perl Wisdom
|
|