App-Kit

 view release on metacpan or  search on metacpan

lib/App/Kit/Obj/NS.pm  view on Meta::CPAN

1;

__END__

=encoding utf-8

=head1 NAME

App::Kit::Obj::NS - Name space utility object

=head1 VERSION

This document describes App::Kit::Obj::NS version 0.1

=head1 SYNOPSIS

    my $ns = App::Kit::Obj::NS->new(…);
    $ns->ns()->have_mod(…)

=head1 DESCRIPTION

name space utility object

=head1 INTERFACE

=head2 new()

Returns the object.

Takes one required attribute: base. It should be an object or name space that it uses for the default “'base' related” methods.

=head3 base

Get and set the object’s base attribute

    my $base = $ns->base;
    $ns->base($obj);

=head2 have_mod()

Lazy wrapper of L<Module::Want>’s have_mod().

=head2 is_ns()

Lazy wrapper of L<Module::Want>’s is_ns().

=head2 normalize_ns()

Lazy wrapper of L<Module::Want>’s normalize_ns().

=head2 ns2distname()

Lazy wrapper of L<Module::Want>’s ns2distname().

=head2 distname2ns()

Lazy wrapper of L<Module::Want>’s distname2ns().

=head2 sharedir()

Lazy wrapper of L<File::ShareDir>’s sharedir() that returns false instead of throwing exception (in that case $@ will be set).

=head2 caller related

=head3 enable(FNS)

Takes one or more full name spaces to functions and enables them directly in the current package, loading the module if necessary.

    $app->ns->enable('Foo::Bar::zing')
    zing(…); # zing() is from Foo::Bar

=head2 'base' related

Eventually the 'base' to use will also be able to be given in the call to the method. For now, it must be set via the base attribute.

=head3 employ(ROLE)

Takes one or more role name spaces or objects and employs them in base via L<Role::Tiny>}s apply_* methods (depending on what base is).

=head3 absorb(FNS)

Takes one or more full name spaces to functions and absorbs them directly into whatever base is. Taking into account that it was a function and now is a method.

    $app->ns->enable('Foo::Bar::zing')
    $base->zing(…); # zing() is from Foo::Bar

=head1 DIAGNOSTICS

=over

=item C<< 'base' must be a valid namespace or object >>

The value you gave for base, either via new or via base(), is not a name space or an object.

=back

=head1 CONFIGURATION AND ENVIRONMENT

Requires no configuration files or environment variables.

=head1 DEPENDENCIES

L<Moo> for the object.

Lazy loaded as needed:

L<Module::Want> L<File::ShareDir> L<Role::Tiny>

=head1 INCOMPATIBILITIES

None reported.

=head1 BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to
C<bug-app-kit@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>.

=head1 AUTHOR



( run in 1.593 second using v1.01-cache-2.11-cpan-39bf76dae61 )