Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Package name overlap

by Dallaylaen (Hermit)
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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1019589]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2018-01-21 17:39 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (228 votes). Check out past polls.