perl bug File::Basename and Perl's nature

Malcolm Dew-Jones yf110 at vtn1.victoria.tc.ca
Sun Jan 25 02:08:29 EST 2004


Xah Lee (xah at xahlee.org) wrote:
: 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".

Well, that's what you asked for, isn't it.

: 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

Well it sounds to me like it says it will do what it did.

: 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.

How is it irrelevent to mention the purpose of the parameter?

: Why the fuck do i need to know what is version, or examination what??

If you don't need to know the version then don't ask the routine to parse
it off of the file name.

As for "or examination what", it takes some pretty obscure, poetical
parsing of english to make sense of this, so I will instead merely assume
you lacked the ability to understand what you read.


: Not every morons in this world is using unix with its morinic
: convention of appending things to file names as a versioning system,

Well that's right isn't it.  Some of us morons use other moronic systems,
such as VMS sometimes.  I must admit though, I rather find VMS's
"moronic", automatic, operating system supported _versioning_ of every
file is an extremely nice feature, allowing me (potentially) to examine,
recover, or reuse, any one of the versions of every file I ever touched
(since the last PURGE, anyway).

And you're right, one has no need to know the version number of a file for
any normal operation on VMS any more than a unix programmer normally needs
to know the inode number of a file, but on the other hand, when you do
certain file manipulations then you do need to know it, and since the
easiest way to access it is via the file name then it looks to me that in
that case the version number returned for my _examination_ by the above
mentioned module might be a good way to do that.

(You sure are rude by the way.)


: and not every moron in this world need to "exam" things. 

"exam" is a noun, and therefore this is also sort of true, but only
because it's a bit of a tautology to say that somene doesn't need to do
something nonsensical.


: 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.

"concocted"?


: But NOOO, ... morons are too enamored with driveling

well well, what do we find at the end, sure enough, this also is true.



More information about the Python-list mailing list