in reply to [DSL] disabling packages in Perl?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [DSL] disabling packages in Perl? (meditation)
by LanX (Saint) on Apr 19, 2016 at 12:55 UTC | |
by haukex (Archbishop) on Apr 23, 2016 at 20:28 UTC | |
|
Re^2: [DSL] disabling packages in Perl? (automatic "no Module"?)
by LanX (Saint) on Apr 21, 2016 at 15:38 UTC |