App-Kit
view release on metacpan or search on metacpan
lib/App/Kit.pm view on Meta::CPAN
sub import {
strict->import;
warnings->import;
unless ( defined $_[1] && $_[1] eq '-no-try' ) { # Yoda was right: there *is* -no-try!
require Try::Tiny;
# Try::Tiny->import(); # not like pragma in import, so:
require Import::Into;
my $caller = caller();
Try::Tiny->import::into($caller);
}
}
# tidyoff
with 'Role::Multiton', # Would like to do ::New but that falls apart once you decide to extend() See rt 89239. For now we TODO the multiton-via-new tests
'App::Kit::Role::Log',
'App::Kit::Role::Locale',
'App::Kit::Role::HTTP',
'App::Kit::Role::NS',
lib/App/Kit/Obj/NS.pm view on Meta::CPAN
#######################
#### caller fiddling ##
#######################
# $app->ns->impose('pragma', 'Mod::Ule', ['foo::bar',1,2,3]);
# maybe if pragmas could happen, otherwise re-think
# Sub::Defer::defer_sub __PACKAGE__ . '::impose' => sub {
# require Import::Into;
# return sub {
# my $self = shift;
# my $caller = caller(1) || caller(0);
#
# for my $class ( @_ ? @_ : qw(strict warnings Try::Tiny Carp) ) {
# my ( $ns, @import_args ) = ref($class) ? @{$class} : ($class);
#
# # ?? if !$self->is_ns($ns);
# $self->have_mod($ns); # or ???
#
# if (@import_args) {
# $ns->import::into( $caller, @import_args );
# }
lib/App/Kit/Obj/NS.pm view on Meta::CPAN
# # d("$ns->import::into($caller);");
# $ns->import::into($caller);
# }
# }
# };
# };
# $app->ns->enable('Foo::Bar::zing', â¦) # zing() from Foo::Bar
sub enable {
my $self = shift;
my $caller = caller(1) || caller(0);
no strict 'refs'; ## no critic
for my $full_ns (@_) {
# ?? if !$self->is_ns($full_ns);
my $func = $self->normalize_ns($full_ns);
if ( $func =~ m/(.+)::([^:]+)$/ ) {
my $ns = $1;
$func = $2;
( run in 0.323 second using v1.01-cache-2.11-cpan-cc502c75498 )