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

alphabetically speaking(in english), there are 26(52 for the case-insensitive) possible file test operators. Honestly,show me where 26 (52) test operators becomes inadequate, and then you may have a case for more descriptive (read: larger length)test operators. Not everything should be overly verbose

if(-'the allmighty file test for directory status passes on' FILE) { with(preceding::zero(4) && decimal::point(2) print '4'); }
This is obviously an extreme exaggeration but, you honestly expect anyone to care that you find the file test operators (a basic perl attribute) inconvenient? please.... If you don't like perl.. don't program in it.. simple as that. I have rants about VB, you don't see me trolling a VB board asking them to change a language I have a dislike for do you?

I'm sure my xp will take a nose dive for this , but I don't care so much.


Grygonos

Replies are listed 'Best First'.
Re^2: Perl::Improved Volume 0, Number 0
by chromatic (Archbishop) on Aug 26, 2004 at 22:26 UTC
    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' );.

      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) {....}