good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Symbolic reference with strict "refs"by davido (Cardinal) |
on Aug 17, 2012 at 16:21 UTC ( [id://988016]=note: print w/replies, xml ) | Need Help?? |
What you're really asking is how to write dodgy code in a way that is obscured from strict's view; a way that either the makers of strict didn't think of, or thought of and figured if you're going to that much trouble you must have your reasons. Still dodgy, and maybe even more-so because it does its little dirty deed so quietly that a future maintainer won't have the benefit of the visual cue that no strict 'refs'; provides. I would opt for the no strict 'refs'; ## no critic (strict) method in the narrowest possible scope. By the way, there are plenty people who's opinions I respect who will tell you that the crime isn't in writing code that requires no strict 'refs';, but in writing such code unnecessarily and dangerously. Dodgy is when it's used to solve a problem created by poor design. Genius is when it falls into the category of "Making difficult things possible." I wanted to mention an article that Mark Jason Dominus wrote. We're all familiar with his article that talks about why it's stupid to use a string as a variable name. But he has another gem that gets a little less attention. Here's the snippet that I find interesting.
Dave
In Section
Seekers of Perl Wisdom
|
|