|No such thing as a small change|
Stopping a package from infesting my namespaceby anneli (Pilgrim)
|on Oct 08, 2011 at 21:50 UTC||Need Help??|
anneli has asked for the
wisdom of the Perl Monks concerning the following question:
Dear sisters and brothers,
I'm using Parse::Lex to generate lexers for a lexer/parser for Erlang source that I'm writing.
Fortunately or unfortunately, when you bootstrap a Lex object, it creates symbol table entries in the calling package for the tokens you've defined for the lexer. The code doing that is Parse/Token.pm, saying:
I'm trying to make my generated lexers at least vaguely re-entrant, so the lexer symbol table is being recreated each time you make a new lexer, meaning I'm getting these lovely "the 'XYZ::ABC' token is already defined" errors. It looks like there's no such thing as an anonymous package, so I can't enter one of those before generating the symbols.
Is there other way (possibly involving black magic) to get these tokens to go elsewhere, or otherwise stop this happening? (preferably without having to mess up Parse::Lex)
Yours in deep respect,