Beefy Boxes and Bandwidth Generously Provided by pair Networks Cowboy Neal with Hat
We don't bite newbies here... much
 
PerlMonks  

Re: RFC: new module r (or R)

by BrowserUk (Pope)
on Mar 05, 2004 at 18:54 UTC ( #334325=note: print w/ replies, xml ) Need Help??


in reply to RFC: new module r (or R)

Personally, I prefer -mr.

...but if the namespace police won't permit that on cpan, it wouldn't matter, because I would simply rename it for local use.

Did you give any thought to depth first -v- breadth first?

It probably wouldn't make any difference at all for most uses. In fact, now I've typed that, the only time it might make a difference is if you were using it to delete files and wanted to also delete the subir if it ended up empty. But that's probably better done with other tools anyway.

The other thought that crossed my mind was I wonder how it would play with the Getopt::short/middle/long/very-very-very-long* modules? I'm not sure when they do there processing of @ARGV? But if the do their processing at BEGIN time, then maybe yours should be done at CHECK time?


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail


Comment on Re: RFC: new module r (or R)
Re: Re: RFC: new module r (or R)
by etcshadow (Priest) on Mar 05, 2004 at 19:25 UTC
    Interference with GetOpt* is a good point... Obviously, the only way such a collision could occur is if there were a directory named "--whatever" or "-w", etc. But it's still the sort of thing that shouldn't be allowed to interfere.

    More reason, I think, to go with the -MR-type notation... as that would give more control (over when and where) to someone who was writing a script, or other module, but wanted to incorporate the @ARGV-recursion of this module.

    Of course, another route would be to make it all under something like RecursiveARGV.pm, and provide a stub r.pm that was just:

    use RecursiveARGV;
    Making perl -mr exactly the same as perl -MRecursiveARGV, but allowing people to do more fun stuff in their scripts like:
    #!/usr/bin/perl require RecursiveARGV; # cleans @ARGV of any switches here, # leaving only files GetOpt(...); # now @ARGV becomes directory-magic RecursiveARGV->import();

    Update: I changed midstream between referring to a more full-fledged module as R.pm and RecursiveARGV.pm... and things got a little tangled up.

    ------------ :Wq Not an editor command: Wq

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://334325]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2014-04-23 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (557 votes), past polls