Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Package name overlap

by Dallaylaen (Monk)
on Feb 19, 2013 at 15:23 UTC ( #1019589=note: print w/ replies, xml ) Need Help??

in reply to Package name overlap

Perhaps you're still better off renaming the module, here's why.

Perl loads every module only once, see %INC in perlvar. So, if English is used internally by some other module down the road (which is likely, because it's 2012 and punctuation variables smell), it will not be loaded again. Instead, your module's import method will be called.

But use English; exports a lot of stuff into the calling package, like $ERRNO etc. And suddenly a random module not even used directly by the code you control breaks with a syntax error message!

Here's a little demo (run it as far as possible from your real!). Note the "not permitted" part is as planned (not a real error). The "echo 1" comand creates a correct empty module.

-bash$ rm -bash$ perl -Mstrict -I. -wle 'use English; $ERRNO=1; print $ERRNO; ' Operation not permitted -bash$ echo 1 > -bash$ perl -Mstrict -I. -wle 'use English; $ERRNO=1; print $ERRNO; ' Global symbol "$ERRNO" requires explicit package name at -e line 1. Global symbol "$ERRNO" requires explicit package name at -e line 1. Execution of -e aborted due to compilation errors.

Comment on Re: Package name overlap
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2015-11-29 21:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (753 votes), past polls