NAME
Ado::Command - Ado namespace for Mojo commands!
DESCRIPTION
Ado::Command is the base class for eventual functionality that we can run directly from the commandline or from controllers. In this class we can put common functionality shared among all the commands.
ATTRIBUTES
args
Returns a hash-reference containing all arguments passed to the command on the commandline or to the method "run". The keys are the long variants of the possible commandline arguments altough you may have used short variants.
#if you passed -s or --something
$self->args->{something} #foo
name
The name of your command - (ref $self) =~ /(\w+)$/;
.
home
Returns current Ado::Command::foo home.
METHODS
init
Must be implemented by the inheriting command.
Should get options from the commandline and populate $self->args
. Must return $self
.
run
A default $command->run(@args)
method for all Ado::Command commands. This is the entry point to your mini application. Looks for subcommands/actions which are looked up in the --do
commands line argument and executed. Dies with an error message advising you to implement the subcommand if it is not found in $self->config->{actions}
. Override it if you want specific behavior.
# as script/pwprefligt alabala --do action --param1 value
Ado::Command::alabala->run(@ARGV);
#or from a controller
Ado::Command::alabala->run(
--do => action => --param1 => 'value' );
config
Returns the configuration portion specific for a command.
#Somewhere in Ado::Command::alabala
$self->config('username')
#Same as $self->app->config('alabala')->{username}
SUBCOMANDS
Subcommands shared by all command classes inheriting this class.
...
SEE ALSO
AUTHOR
Красимир Беров (Krasimir Berov)
COPYRIGHT AND LICENSE
Copyright 2013 Красимир Беров (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.