Hello, all.
In response to
this node, I decided to finallize and publish
something I've been working on... a module that replaces directories in @ARGV with their contents, recursively (by
tieing @ARGV, and traversing directories as they are accessed). The idea is (obviously) that a user could type:
perl -mr -ne 'print if /foo/' *
and get the same behavior as from
grep -r foo *
Anyway, the thing that I'm offering for comment is basically, should I make it
-mr or make it
-MR? (And also, of course, if anyone has a reasonable reason why I'd be on crack to even do this, or that it's already been done in a useful enough manner.) The obvious implication being that the
tie @ARGV,... occurs either in file-scope or in the
import method... which is a miniscule code change, that I'd be happy to make before offering this up to CPAN.
My reasons for wanting to use -mr over -MR are perhaps silly, but quite frankly:
- it saves a keystroke (the shift key)
- it is mostly going to be used with other lower-case switches (-p, -n, -e, -i, -l)
- it's a closer syntax to its closest cousin, grep -r
I think those are all valid things to consider, since we're talking about what effectively amounts to a command line switch.
The costs, however, are that:
- a lowercase module name implies that it is a pragma... and this is only sort of like a pragma (but not really)
- it won't work quite like a normal module, being use'd, because the magic occurs when the file is required, without anything happen at import time
I think it's obvious that the m and r should be in the same case, as
perl -mR -e ... or
perl -Mr -e ... are just shift-key gymnastics that nobody wants or should have to go through.
Thoughts? Comments? Also, is there a more definitive place to take this question, like comp.lang.something-or-other?
------------
:Wq
Not an editor command: Wq