Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Weird File::Basename::basename (yes, but)

by Anonymous Monk
on Mar 26, 2013 at 15:26 UTC ( #1025542=note: print w/ replies, xml ) Need Help??


in reply to Weird File::Basename::basename

Is this a bug?

Yes , I think so.

See http://perl5.git.perl.org/perl.git/blob/HEAD:/lib/File/Basename.t, its a typical bug (if a boundary condition isn't tested, chances are it'll be broken)

OTOH, on the scale of importance/severity, I would classify this bug as unimportant

FWIW, you should perlbug it just the same :) functions should do what they claim to do -- and they might as well explicitly spell out what that is instead of merely referring to the manpages -- I'll bet if the pod actually spelled out the full behaviour, there would have been a test for it in the test suite :)


Comment on Re: Weird File::Basename::basename (yes, but)
Re^2: Weird File::Basename::basename (yes, but)
by hdb (Prior) on Mar 26, 2013 at 15:43 UTC

    On the importance of this bug: In a way "./" is the neutral element in pathes in the sense of adding it anywhere in the path does not change anything (except in the middle of a name obviously).

    One exception springs to mind: When executing a command it does make a difference whether to say

    system("somecommand"); # or system("./somecommand");

    Whether or not this can happen due to the usage of basename('') in any practical example I am not sure.

      When executing a command it does make a difference whether to say "foo" or "./foo"

      not on cmd.exe, cwd is first place searched

      :) spec/basename are useful, but they're kinda low-level, I prefer abstractions like Path::Class and Badger::Filesystem and absolute paths, so file( ... )->absolute

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025542]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2015-07-06 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (81 votes), past polls