NAME
Ado::Plugin - base class for Ado specific plugins.
SYNOPSIS
# CamelCase plugin name
package Ado::Plugin::MyPlugin;
use Mojo::Base 'Ado::Plugin';
sub register {
my ($self, $app, $conf) = @_;
$self->app($app);#!Needed in $self->config!
#Merge passed configuration with configuration
#from etc/ado.conf and etc/plugins/my_plugin.conf
$conf = {%{$self->config},%{$conf?$conf:{}}};
# Your magic here! :)
}
DESCRIPTION
Ado::Plugin is a base class for Ado specific plugins. It provides some methods specific to Ado only.
ATTRIBUTES
Ado::Plugin provides the following attributes for use by subclasses.
app
my $app = $self->app;
$command = $self->app(MyApp->new);
Application for plugin, defaults to a Mojo::HelloWorld object.
# Introspect
say "Template path: $_" for @{$self->app->renderer->paths};
name
The name - only the plugin name without the namespace.
$self->name #MyPlugin
METHODS
Ado::Plugin provides the following methods for use by subclasses.
config
The configuration which is for the plugin only.
$self->config
#everything in '$ENV{MOJO_HOME}/etc/plugins/'.decamelize('MyPlugin').'.conf'
#or under $app->config('MyPlugin')
#or $app->config('my_plugin') - in this order
my $value = $self->config('key');
SPONSORS
The original author
SEE ALSO
Ado::Manual::Plugins, Ado::Plugin::Routes, Mojolicious::Plugin
AUTHOR
Красимир Беров (Krasimir Berov)
COPYRIGHT AND LICENSE
Copyright 2013-2014 Красимир Беров (Krasimir Berov).
This program is free software, you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License v3 (LGPL-3.0). You may copy, distribute and modify the software provided that modifications are open source. However, software that includes the license may release under a different license.
See http://opensource.org/licenses/lgpl-3.0.html for more information.