- resent to p5p, oops. [dcd@tc.fluke.com - Wed Dec 4 15:34:58 2002]: > the documenation for File::Basename includes the example > > $basename = basename("lib/File/Basename.pm",qr{\.pm}); > > which leads the reader to think that the regular expression would be > processed reasonably. I expected $basename to be set to "Basename" > but instead got "Basename.pm" > If a suffix is going to be passed and used, perhaps the example should > be changed to: > $basename = basename("lib/File/Basename.pm",".pm"); > (which does yield "Basename".) 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. > 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? > I couldn't find a test case that in Basename.t that showed the given > example working one way or the other. - R. # attached, Mail.app corrupts inline diffs --- lib/File/Basename.pm.orig 2003-02-11 10:03:17.000000000 -0500 +++ lib/File/Basename.pm 2003-02-11 10:12:07.000000000 -0500 @@ -19,7 +19,7 @@ ($name,$path,$suffix) = fileparse("lib/File/Basename.pm",qr{\.pm}); fileparse_set_fstype("VMS"); - $basename = basename("lib/File/Basename.pm",qr{\.pm}); + $basename = basename("lib/File/Basename.pm",".pm"); $dirname = dirname("lib/File/Basename.pm"); =head1 DESCRIPTIONThread Next