develooper Front page | perl.module-authors | Postings from August 2018

[naminng] namespace::local - is it a good name?

Thread Next
From:
Konstantin S. Uvarin
Date:
August 26, 2018 10:57
Subject:
[naminng] namespace::local - is it a good name?
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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About