Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

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?!

Replies are listed 'Best First'.
Re^6: magic-diamond <> behavior -- WHAT?! (boggle)
by tye (Sage) 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        

      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        

      Maybe tainting is silly, but it is available now, not maybe tomorrow.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://720436]
[Corion]: Discipulus: Better buy a new PC (well, self-build one from parts) than buy a new car :-)
[choroba]: the boot time on my laptops is more than satisfactory, but the desktop boots in 30+ secs
[choroba]: because of some problems of the wicked with systemd :-(
[Corion]: choroba: Just imagine how bad it must be without systemd ;-D

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (12)
As of 2017-07-27 09:12 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (407 votes). Check out past polls.