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. > > > > > Second -- is it's not easy to shut them off. > > It's trivial to shut them off: Just remove -w. > There is no reason to use -w in any perl that supports 'use warnings' > (i.e. 5.6 or better). ---- 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. I usually support modules, like POSIX, exporting all of their needed routines, but with large export lists, it becomes even more important not to do so blindly, but check to see if the module is already defined in the user's context and only issue warnings for those modules that the user has specifically requested (as in use POSIX qw(getcwd) ). That's a reasonable approach. Second -- I clearly stated that in most of my programs putting a "no warnings" before something that is emitting warnings HAS overridden the specification of "-w" on the interpreter line. To go off and tell me why that doesn't work flied in the face of plenty of other examples. Should I report the 20-score or more cases where it does work as bugs? > > For one reason or another, the > > 'no warnings' in front of the > > 'use POSIX' doesn't turn them off. > > The reason is that 'use warnings'/'no warnings' is lexical, i.e. it only > affects code in the current block. The actual subroutine redefinition, > however, happens in the POSIX module (or probably in Exporter, even). > There's no way to influence warnings from other modules via 'use > warnings'/'no warnings'. --- See above... I'm now wondering about the majority of the cases where it does work... and wondering why... 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? --- via perlbug: queue: perl5 status: open https://rt.perl.org:443/rt3/Ticket/Display.html?id=117969Thread Previous | Thread Next