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:
Aristotle Pagaltzis
Date:
May 12, 2013 18:33
Subject:
Re: [perl #117969] use POSIX emits multiple warnings if used after"Cwd"
Message ID:
20130512183339.GA7709@fernweh.plasmasturm.org
* Linda Walsh via RT <perlbug-followup@perl.org> [2013-05-12 19:15]:
> 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.

That’s how exporting works in Perl. POSIX is not doing anything unusual.

Skipping already-defined functions silently would be just as bad; The
only difference would be that you get the first instead of the last
exported function with the conflicted name. It would just hide the
conflict rather than fix it, and your code would still only be working
accidentally.

If it weren’t silent but gave a warning, then redefining vs skipping is
a wash – except that skipping incurs some more complexity to implement.

But if it did warn, you would still be coming here to complain about it.

So whether or not functions are blindly redefined on export makes no
difference – the fix for your problem is to make your code not ask two
different modules to export a function with the same name, irrespective
of whether you made it do that on purpose or not.

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