in reply to Re: given when support in 5.8.8?
in thread given when support in 5.8.8?
Looking for perlcritic safe modules...
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: given when support in 5.8.8?
by davido (Cardinal) on Aug 21, 2012 at 05:57 UTC | |
Does that requirement strike anyone else as ironic? From the POD for Switch: "Copyright (c) 1997-2008, Damian Conway. All Rights Reserved." From the POD for Perl::Critic: "Most Policy modules are based on Damian Conway's book Perl Best Practices." It's no surprise that Perl::Critic policies had to be violated to create Switch. Here are some of the obstacles you're going to encounter in finding a module that emulates given and when while at the same time not violating any of the Perl::Critic rules: And those are just the things that Perl::Critic complains about at "severity=5". As you approach greater severity it's going to get uglier fast. But most importantly, Switch isn't even "recommended" nowadays. It is a source filter. It has some serious limitations. So what about alternatives? There really is no given/when emulation available for Perl 5.8.x that doesn't make compromises to achieve the magic. If the compromises are a deal-breaker (and they probably ought to be, really), you'll have to shift to a different tack. App::perlbrew will assist you in installing a version of Perl that can co-exist with your system's Perl, and that doesn't require elevated privileges to install. If your constraint to v5.8.x is based on the limitations of what's installed on the system and what you have permission to install globally, perlbrew might help you to overcome those limitations. On the other hand, if the limitation is that your client requires that you stick with 5.8.x, you may need to take a step back from the problem and examine other ways to achieve your goal. Perl existed for nearly 20 years without given/when, and its addition to Perl's syntax didn't suddenly make some hard things possible. It really only serves to make some things easier. But it's not the only tool that can be used to accomplish the same result. We don't know anything about the code you're contemplating, so we can't really comment on what pre-given/when syntax you should choose. But rest assured there is a solution to any problem that given/when solves, even without using given/when. Dave | [reply] [d/l] [select] |
Re^3: given when support in 5.8.8?
by Anonymous Monk on Aug 21, 2012 at 06:29 UTC | |
Looking for perlcritic safe modules... LOL! | [reply] |