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 tie
ing @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?
Not an editor command: Wq
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||