Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Package name overlap

by Dallaylaen (Scribe)
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 making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-10-31 23:45 GMT
Find Nodes?
    Voting Booth?

    For retirement, I am banking on:

    Results (225 votes), past polls