From: xah@... (Xah Lee) Date: 2004-01-25T14:35:03+09:00 Subject: perl bug File::Basename and Perl's nature Just bumped into another irresponsibility in perl. the crime in question this time is the module File::Basename. Reproduction: 1. create a directory containing a file of this name: "cdrom.html". 2. "use File::Basename;", with the line: ($name,$path,$suffix) = fileparse($File::Find::name, ('.html', '.m')); 3. Notice that your cdrom.html will be parsed into "cdr" with suffix "om.html". expletive Perl and Perl slinging morons. Now, if you peruse the "documentation" of "perldoc File::Basename", you'll see that it shouldn't be so. AND, the writting as usuall is fantastic incompetent. To illustrate, i quote: --begin quote fileparse The fileparse() routine divides a file specification into three parts: a leading path, a file name, and a suffix. The path contains everything up to and including the last directory separator in the input file specification. The remainder of the input file specification is then divided into name and suffix based on the optional patterns you specify in @suffixlist. Each element of this list can be a qr-quoted pattern (or a string which is interpreted as a regular expression), and is matched against the end of name. If this succeeds, the matching portion of name is removed and prepended to suffix. By proper use of @suffixlist, you can remove file types or versions for examination. --end quote Note the last sentence: "By proper use of @suffixlist, you can remove file types or versions for examination." Now, this is in sync with the usual verbiages of unix man pages, of mentioning irrevalent things. Why the fuck do i need to know what is version, or examination what?? Not every morons in this world is using unix with its morinic convention of appending things to file names as a versioning system, and not every moron in this world need to "exam" things. The unix irrevalency, inprecision, driveling are paragoned above. Here is a better documentation for the fileparse subroutine. fileparse fileparse divides a file name into 3 parts: directory string, file name, file name suffix. fileparse($filename, @suffixes) returns a array of 3 elements ($name, $dir_path, $suffix). The concocted result of "dir_path$name$suffix" is guaranteed to equal to $filename. The @suffixes is a array of strings, for example ('\.html', '\.txt', '\.png'). These strings are interpreted to be regular expressions, and is matched against the end of $filename. But NOOO, perl morons are too enamored with driveling to write such functional spec, after all, the code is sloppy and they don't REALLY know what the code really does. This is not just one incompetence. Perl is filled with them. This report is on Perl version: This is perl, v5.8.1-RC3 built for darwin-thread-multi-2level (with 1 registered patch, see perl -V for more detail) -- To the rookie programers out there, i advice against learning Perl. (i suggest Python instead) Please see http://xahlee.org/UnixResource_dir/perlr.html Xah xah@xahlee.org http://xahlee.org/PageTwo_dir/more.html