develooper Front page | perl.perl5.porters | Postings from May 2013

Re: [perl #117969] use POSIX emits multiple warnings if used after"Cwd"

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
May 12, 2013 17:31
Subject:
Re: [perl #117969] use POSIX emits multiple warnings if used after"Cwd"
Message ID:
20130512173106.GA3729@plum.flirble.org
On Sun, May 12, 2013 at 10:10:49AM -0700, Linda Walsh via RT wrote:
> On Sat May 11 23:17:18 2013, plokinom@gmail.com wrote:
> > No, that's normal. You're loading two modules, each of which redefines 
> > main::getcwd().
> ---
> The idea that that the POSIX module would blindly redefine common
> functions is entirely a short-coming in the POSIX module.

Depends on one's idea of common. Both modules are *documented* as defining
a routine with the same name, and, as it turns out, both have exported it
by default since 5.000.

>      It turns out that putting the CWD module 2nd silences the problem
> as it doesn't have the same bug as the POSIX module.  If the warning
> happened in both instances, I'd say you have a point.  But the fact that
> it doesn't means that the POSIX module it redefining things that are
> already defined when it has not been asked to.

No, it is doing exactly what you asked it to do - by default it exports
everything. It happens that the two modules have conflicting exports.
This will not be the only case of it.

> Should I report the 20-score or more cases where it does work as bugs?

Depends if they are actually bugs. This is working as documented. That it's
documented behaviour is not what you want or expect is *not* a bug.

If the 20 are all documented behaviour, then generating 20 bugs which someone
has to reject is not useful.

> FWIW.. in my usage case, require POSIX was all that was needed,
> I didn't rely on any exported names (as I didn't know that they were
> exported let alone, that one of them conflicted with Cwd or that they
> would stomp on the namespace).
> 
> The fact that it stomps on namespace and issues warnings for things as
> it overwrites things that have not been explicitly imported seems an
> unfriendly default for a CORE module, no?

Possibly, but this behaviour has existed for the past 18.5 years. It's not
going to change now.

I am going to mark this bug as rejected.

Nicholas Clark

Thread Previous | Thread Next


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