Catalyst-Authentication-RedmineCookie
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
inc/MyContainer.pm view on Meta::CPAN
package MyContainer;
use Modern::Perl;
use Carp qw(confess);
sub new {
my $class = ref $_[0] || $_[0]; shift;
my $self = bless {}, $class;
$self;
}
sub import {
my $class = ref $_[0] || $_[0]; shift;
my $name = $_[0] || 'container';
my $pkg = caller;
no strict 'refs';
no warnings 'redefine';
*{"${pkg}::${name}"} = sub {
# container('name') or
# $c->container('name') or
# MyApp::Web->container('name') or
# MyApp::Web::container('name')
shift if @_ and ( ref $_[0] || $_[0] ) eq $pkg;
if (@_) {
my $method = shift;
unless ($class->instance->can($method)) {
confess "such a method not exists. ${class}::$method";
}
$class->instance->$method(@_);
}
else {
$class->instance;
}
};
}
sub instance {
my $class = shift;
no strict 'refs';
${"${class}::INSTANCE"} ||= $class->new;
}
########################################################################
use Cwd qw(abs_path);
use File::Spec::Functions qw(catdir catfile splitdir);
use Module::Runtime qw(use_module);
sub app_class {
my $self = shift;
$self->{app_class} //= ref($self) =~ s/::[^:]+$//r;
}
sub app_class_lc {
my $self = shift;
$self->{app_class_lc} //= lc $self->app_class;
}
sub app_home {
my $self = shift;
view all matches for this distributionview release on metacpan - search on metacpan
( run in 2.036 seconds using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )