in reply to Re^4: unquoted string error??!!
in thread unquoted string error??!!

What do you propose to do, change all those to meet the new purity laws?

Certainly not, even if this were about purity or had a the force of fiat.

However, for those documents which I do create or edit, I prefer to explain those practices I perceive to be "better" (in any or every sense of less code, fewer side effects, more secure, easier to read, better encapsulated, or subjectively more pleasing aesthetically) and, having explained my reasoning, explain the alternative (and, let's be fair, often more historical) approaches.

The current doc policy seems to be to remove all mention of things “we don’t like”; how does that serve the public good?

You may be overstating things; it's certainly easy to find voluminous examples of multiple approaches pre- and post-5.6.0 throughout the documentation. If there were a diktat to scrub from history even the lingering scent of package global typeglob filehandles, the best one could say about it is that at least it moves slowly.

Security flaws? Don’t you think that’s unnecessarily overstating things?

Only in the sense that local privilege escalation errors are less bothersome than remote privilege escalation errors. Certainly I hope that the last line of defence never comes down to the presence or absence of a space between file mode and filename in the two-argument form of open, but I use the three-argument form on my own pervasively so I never have to worry about it not being a line of defence.

Filehandles seem at to me to be the least of several worrisome bareword issues.

Predeclared (but not imported) subs are less a concern to me than bareword filehandles, but even though I know (most of) the rules of bareword disambiguation, I don't trust myself to remember all of the possible ways code I write could fall afoul of the mismatch between my heuristics and those of toke.c. Certainly careful forethought helps as do good habits and plenty of practice, but given a reasonable and well-distributed alternative that has other advantages, my preference is clear.

I'd even write class names such as My::Class::, if one percent of CPAN authors also did so. Alas, that disambiguation is so relatively unknown.

Replies are listed 'Best First'.
Re^6: unquoted string error??!!
by tchrist (Pilgrim) on May 05, 2011 at 01:27 UTC
    You’re right that imported subs are the primary issue, since that’s too much like strange action at a distance. I don’t expect to hose myself so obviously as in the code I showed. There isn’t really a good solution, or a really good solution, or something like that.

    As for using package-quoted names like IO::Handle::, I actually do it pretty regularly; it automatically cleans up problems that most people don’t ever want to know about.

    We’ve known of this approach for a very long time now, so there’s no excuse not to use it. Perhaps better stated, I don’t consider general CPAN ignorance of it to be any excuse not to use it. What you don’t know can hurt you.

    I’m sure there is no shortage of CPAN authors who neglect to check the return values of their close calls, too, but that isn’t going to stop me from religiously doing so. I try to apply more rigorous standards of correctness (or even advisability) than simply looking to majority practice. That’s too much like using Google to rank various misspellings to decide which one “must” be right.

    Try it, you’ll like it. Who knows, you could even be a trend-setter.

      The only places I've ever seen bareword class names go wrong in practice is with single-element names such as CGI or (recently) JSON. Naming conventions can alleviate that, but that might be a good place to start.

      I remember the other reason I hesitated to do so: aliased. I'm not sure whether that's a pro or a con.