Hi Rolf,
The three things that come to my mind are unimport via no, namespace::clean (update: or namespace::autoclean or namespace::sweep), or lexically scoped pragmas via %^H/perlpragma. I haven't used any of them in a module of my own, so I can't say much more, but maybe one of them is a starting point?
Update: That was just a bit of brainstorming - I guess the first two ideas are effective at package scope, the third at lexical scope, and then of course there's dynamic scope... I guess I'm not sure what scope you're thinking about "disabling" the package at? Also, by "disabling", do you mean actually undefining the methods, or just setting a flag such that they fail when called outside of the appropriate scope (whichever one that is)? And one more thought: Do you really need to disable the packages, or is it just a "safety" measure against accidental usage outside the correct scope? I imagine that packages named IN and LIKE are unlikely to clash with other packages...
Regards,
-- Hauke D
In reply to Re: [DSL] disabling packages in Perl? (updated)
by haukex
in thread [DSL] disabling packages in Perl?
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |