[naminng] namespace::local - is it a good name?
[email protected] ("Konstantin S. Uvarin") Sun, 26 Aug 2018 13:57:05 +0300
| Newsgroups | perl.module-authors |
|---|---|
| Message-ID | <CAJj2qWni7vj8p4Gbe1Kp4PxJR1eRbZRsm5jPgO4dq-osQZ3m1A@mail.gmail.com> |
Hello,
Preface. `namespace::clean` is a module that erases symbols imported prior
to its `use` line:
package Foo;
use Scalar::Util qw(blessed);
use namespace::clean;
blessed ($x); # ok
Foo->blessed; # nope, no such method
There are also namespace::autoclean and namespace::sweep (at least) in the
same `namespace` namespace.
Now after looking at namespace::clean I came up with a variation that
limits imports to its enclosing scope:
package Foo;
# no traces of blessed exist
sub uses_blessed {
use namespace::local;
use Scalar::Util qw(blessed);
blessed ($x); # ok
Foo->blessed; # nope, no such method
};
# no traces of blessed exist
See more at http://prepan.org/module/nYiS6m8kTir
However, I doubt about he name. Is it clear enough? Is it likely to clash
with something else?
Thank you.
--
Konstantin S. Uvarin
jabber: see <from>
skype: kuvarin
http://github.com/dallaylaen