=head1 NAME MojoX::Loader - Loader of any Mojolicious Controller Modules in standalone script =head1 SYNOPSIS # script.pl use MojoX::Loader; # Load App::User controller (App/User.pm) uses the base application module App (App.pm) my $user = MojoX::Loader->load(controller => 'App::User'); # or # Load MyApp::User controller (MyApp/User.pm) uses the base application module MyApp (MyApp.pm) my $user = MojoX::Loader->load(app => 'MyApp', controller => 'MyApp::User'); # call the _total method from MyApp::User say $user->_total; =head1 DESCRIPTION L is a module can load any Mojolicious Controller Modules in a standalone scripts (none Mojolicious scripts). =head1 ATTRIBUTES L implements the following attributes. =head2 C my $app = $loader->app; $app = $loader->app('MyApp'); Name of the base Mojolcious application, the default value is I. =head2 C my $c = $loader->controller; $c = $loader->controller('MyApp::User'); Name of the Mojolicious Controller, the default value is I. =head2 C my $log = $loader->log; $app = $loader->log(Mojo::Log->new); The logging layer of your application, by default a L object with debug level and STDERR handler. =head2 C my $prefix = $loader->prefix; $prefix = $loader->prefix('../../'); The prefix for any path in application, for example renderer root. =head1 METHODS L inherits all methods from L and implements the following new ones. =head2 C my $user = MojoX::Loader->load(app => 'App', controller => 'App::User', prefix => '../../'); Load any Mojolicious Controller of application. =head1 EXAMPLES #!/usr/bin/env perl use common::sense; use lib qw(../.. ../../lib); use MojoX::Loader; my $user = MojoX::Loader->load(controller => 'App::User', prefix => '../../'); # call the method _total say $user->_total; <>; # call the helper db say $user->db; <>; # call the helper conf say $user->conf('server')->{www}; <>; # call the helper from App::Helpers say $user->format_digital('1234567'); <>; # render any template say $user->render_partial('mail/test', format => 'mail'); =head1 SEE ALSO L L L. =head1 AUTHOR Anatoly Sharifulin =head1 BUGS Please report any bugs or feature requests to C, or through the web interface at L. We will be notified, and then you'll automatically be notified of progress on your bug as we make changes. =over 5 =item * Github L =item * RT: CPAN's request tracker L =item * AnnoCPAN: Annotated CPAN documentation L =item * CPANTS: CPAN Testing Service L =item * CPAN Ratings L =item * Search CPAN L =back =head1 COPYRIGHT & LICENSE Copyright (C) 2011 by Anatoly Sharifulin. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut