NAME
Mojo::Shortcut - Mojo::Abstract - loading classes and methods by short#cuts
VERSION
version 0.003
SYNOPSIS
my @args = ('foo#bar', namespaces => ['My']);
my $shortcut = Mojo::Shortcut->new(@args);
# find a class My::Foo
my $class = $shortcut->class;
$class->bar();
# get a cb, that can be called as 'My::Foo::bar()' without firts argument
my $cb = $shortcut->cb;
$cb->();
# create an instance of My::Foo like and invoke a method bar;
# My::Foo->new(attr1 => 'val1')->bar()
$shortcut->invoke(attr1 => 'val1');
METHODS
new
Creates a new object
cb
Returns a code reference
invoke
Creates an instance of class and invokes an action immidietly
class
Finds a class and returns it. Is simmilar like Mojolicious finds a controller class, but also checks if a class has a method
ATTRIBUTES
namespaces
base_classes
If defined, class method will check if a class is a subclass of base_classes This attribute is required
action
action, if is defined, class will check if class returned class can do it
moniker
Short name of class
AUTHOR
alexbyk <alex@alexbyk.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2014 by alexbyk.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.