develooper Front page | perl.perl5.porters | Postings from March 2003

Re: [PATCH] Re: [perl #18872] File::Basename example misleading

Thread Previous
From:
hv
Date:
March 2, 2003 15:09
Subject:
Re: [PATCH] Re: [perl #18872] File::Basename example misleading
Message ID:
200303022311.h22NBwb10684@crypt.compulink.co.uk
Richard Soderberg <perl@crystalflame.net> wrote:
:That's interesting; fileparse() accepts regexes for extensions, but 
:basename() specifically \Q\E's the input, to *ensure* it's not a regex. 
:  I've attached a patch against @18691 that updates the documentation, 
:at least.

Thanks, applied as #18810.

:> I myself would prefer to instead recognize that a regexp was passed 
:> in, and process in a way that that the given example with the 
:> suffixlist set to qr{\.pm} would return $basename as "Basename" I'm 
:> pretty sure the code today isn't doing what it should.
:
:Is there any reason to change this behaviour?  Why was it \Q\E'd in the 
:first place?

The docs say:
       "basename"
           The basename() routine returns the first element of
           the list produced by calling fileparse() with the same
           arguments, except that it always quotes metacharacters
           in the given suffixes.  It is provided for programmer
           compatibility with the Unix shell command basename(1).

Hugo

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About