in reply to Re: Re: Re: Re: Getting the filename from full path name ?
in thread Getting the filename from full path name ?

  • Comment on Re: Re: Re: Re: Re: Getting the filename from full path name ?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Getting the filename from full path name ?
by demerphq (Chancellor) on Apr 15, 2004 at 15:46 UTC

    there's the unix utility called basename,

    And? Theres no such thing in Win32 nor a bunch of the other OS'es that Perl supports.

    Im sorry to be a bit snarky, but jusitfying a feature in perl by its existance in UNIX isnt actually a very helpful argument, Perl isnt UNIX and UNIX users arent even a majority in the community anymore.

    And IMO I fail to see how:

    my ($vol,$path,$filename)=splitpath($spec);

    is any less clear than using basename. And considering that a pathname often follows a basename id say its all the better because you get it all in one sub call. Anyway, if you feel better about having a basename sub then go right ahead, but I cant see people in p5p or Ken Williams agreeing. Hell, he even argued (and as maintainer won) that File::Spec shouldnt have a way to split arbitrary path strings properly, only one to split $ENV{PATH} itself. Which I personally thought was a pretty bad call. But whatever. :-)


    ---
    demerphq

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


      there's the unix utility called basename,
      And? Theres no such thing in Win32 nor a bunch of the other OS'es that Perl supports. Im sorry to be a bit snarky, but jusitfying a feature in perl by its existance in UNIX isnt actually a very helpful argument, Perl isnt UNIX and UNIX users arent even a majority in the community anymore.
      Perl is deeply rooted in Unix. We have s/// (sed), tr, a2p, s2p, obscure function names like grep, and there's even basename, but only in a module which is not liked anymore.

        Im aware that Perl is deeply rooted in Unix. And im happy about that. But that doesn't mean that there arent other better ways of doing things. One of those better things is that File::Spec has replaced File::Basename. :-) Which is about as OS agnostic as you get. Which is also a good thing. Portability++


        ---
        demerphq

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