Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: magic-diamond <> behavior -- WHAT?!

by JavaFan (Canon)
on Oct 30, 2008 at 10:14 UTC ( #720436=note: print w/ replies, xml ) Need Help??


in reply to Re^4: magic-diamond <> behavior -- WHAT?!
in thread magic-diamond <> behavior -- WHAT?!

I know now, but how about the uninformed?
There will always be uninformed people. That's why there's documentation. Dumbing down a language for the uninformed cripples a language. It's as useful as turning cars into bumper cars, just because someone uninformed sits behind the wheel.


Comment on Re^5: magic-diamond <> behavior -- WHAT?!
Re^6: magic-diamond <> behavior -- WHAT?! (boggle)
by tye (Cardinal) on Oct 30, 2008 at 13:33 UTC

    Wow. Did you really write that? The words are right there, and yet I still find their existance dubious. (:

    Perhaps you should go read the documentation. Show me a single example in the documentation of using <> correctly (based on the current implementation) and I'll show a dozen counter-examples where <> is used dangerously in the standard documentation. Of course, your example would have only fairly recently been added, since for the majority of the existence of <>, no such example existed in the standard documentation (and I didn't run into any when I browsed several sections of the latest release of the documentation just hours ago).

    Nobody is proposing crippling anything. Make getting the magical behavior require a tiny extra invocation (-Margv or similar).

    Of course, it is impossible to document how to use -i correctly, but why fix -i when it might require slight modifications to a tiny, tiny fraction of the uses of <> by people who likely bragged about the freaky thing they did when they wrote them?

    Pity the fool who read perlrun, for example, and was extra careful about evily named files by using "find -print0" and followed the helpful suggestion from the standard Perl documentation and pasted and slightly modified to get:

    find /tmp -mtime +7 -print0 | perl -n0e unlink

    into root's crontab to clean out /tmp daily.

    And, no, tainting is not what should be done in such situations. An entry in root's crontab does not need to worry about environment variables being evily set. Proposing taint checking as a band-aid for the fact that something as ubiquitous as -n and -p will leak file names into the execution stream is just silly.

    - tye        

      Maybe tainting is silly, but it is available now, not maybe tomorrow.
      I fail to see what
      find /tmp -mtime +7 -print0 | perl -n0e unlink
      has to do with magic open.

      In the above fragment, perl reads the files to unlink from STDIN, not from ARGV, and no magic open happens.

        Ah, thanks. I was fooled by -n.

        - tye        

Re^6: magic-diamond <> behavior -- WHAT?!
by Anonymous Monk on Oct 30, 2008 at 16:31 UTC
    There will always be uninformed people. That's why there's documentation.

    So you agree that either the language or the documentation should be fixed!

      Well, I think magic open should stay as is, and I know that it's documented, so I don't see a need to fix the documentation.

      But documentation patches are about the easiest patches you can make, and the most likely to be accepted. If people think the current documentation isn't good enough, by all means, instead of bickering about it, write a patch.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (14)
As of 2014-07-24 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (160 votes), past polls