Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Perl::Improved Volume 0, Number 0

by chromatic (Archbishop)
on Aug 26, 2004 at 22:26 UTC ( [id://386196]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl::Improved Volume 0, Number 0
in thread Perl::Improved Volume 0, Number 0

Not everything should be overly verbose

I don't think that's Wassercrats' point. It's easy to understand why the file test operators in the shell are so short -- they're common operations there. Based on my Perl corpus though, I don't use them often enough to justify two-character operators.

Now it'd be terrible practice for me to pronounce the one true way based on a single corpus, but as I mostly program applications and not administration scripts, I wouldn't mind terribly much using something like File::exists( 'filename' );.

Replies are listed 'Best First'.
Re^3: Perl::Improved Volume 0, Number 0
by Solo (Deacon) on Aug 27, 2004 at 02:22 UTC
    File::exists( 'filename' );

    This seems like a natural addition to English, but I think it would need something more like a source filter and less like the typeglob diddling of English, so it's not an easy addition.

    Update: demerphq has the right of it... just a sub File::exists($) { -f $_[0] } would do it.

    --Solo

    --
    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.

      demerphq has the right of it...

      Well to be picky i think that that code will have a minor incompatibility with the normal file test operators regarding the magic filehandle '_', since File::stat() shares this problem I dont think its a showstopper really. And I guess if one doesn't like the current filetest names its unlikely that one would be happy with using the special filehandle:

      $filesize=-s _ if (-e $foo);

      would become

      $filesize=File::size($foo) if File::exists($foo);

      Which is of course less efficient.


      ---
      demerphq

        First they ignore you, then they laugh at you, then they fight you, then you win.
        -- Gandhi


      In 5.10, one will be able to write:
      if (-w -x -r $file) {....}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found