http://www.perlmonks.org?node_id=930401


in reply to Re^2: Stopping a package from infesting my namespace
in thread Stopping a package from infesting my namespace

I guess my question then is are the reused symbols/tokens really a problem, or is it just the warnings? Do the tokens need to be scoped tighter than global to avoid conflict?

If it's just the warnings, you can turn them off a variety of ways, like using 'use warnings;' (lexically scoped to just your own code) instead of 'perl -w' (global). If you do modify exportTo(), you can also just remove the Carp call. That 'if ($^W)' is just checking to see if warnings are enabled.

--Dave

  • Comment on Re^3: Stopping a package from infesting my namespace

Replies are listed 'Best First'.
Re^4: Stopping a package from infesting my namespace
by anneli (Pilgrim) on Oct 09, 2011 at 03:34 UTC

    I think it could technically cause an issue because the tokens contain subs which close on the environment around them; if someone used two of the parsers in different contexts, the latter one's state might end up being used for the former, too!

    So far I've tried to 'solve' this just by encapsulating these objects well enough such that they're never exposed to the user, so I deal with these issues in the interface (though the module becomes non-reentrant).