Mojo::Commands(3) Commands

SYNOPSIS


use Mojo::Commands;
# Command line interface
my $commands = Mojo::Commands->new;
$commands->run(@ARGV);

DESCRIPTION

Mojo::Commands is the interactive command line interface to the Mojo framework. It will automatically detect available commands in the Mojo::Command namespace. Commands are implemented by subclassing Mojo::Command.

These commands are available by default.

"help"
    mojo
    mojo help

List available commands with short descriptions.

    mojo help <command>

List available options for the command with short descriptions.

"generate"
    mojo generate
    mojo generate help

List available generator commands with short descriptions.

    mojo generate help <generator>

List available options for generator command with short descriptions.

"generate app"
    mojo generate app <AppName>

Generate application directory structure for a fully functional Mojo application.

"generate makefile"
    script/myapp generate makefile

Generate "Makefile.PL" file for application.

"generate psgi"
    script/myapp generate psgi

Generate "myapp.psgi" file for application.

"cgi"
    mojo cgi
    script/myapp cgi

Start application with CGI backend.

"daemon"
    mojo cgi
    script/myapp daemon

Start application with standalone HTTP 1.1 server backend.

"daemon_prefork"
    mojo daemon_prefork
    script/myapp daemon_prefork

Start application with preforking standalone HTTP 1.1 server backend.

"fastcgi"
    mojo fastcgi
    script/myapp fastcgi

Start application with FastCGI backend.

"get"
   mojo get http://mojolicious.org
   script/myapp get /foo

Perform GET request to remote host or local application.

"test"
   mojo test
   script/myapp test
   script/myapp test t/foo.t

Runs application tests from the "t" directory.

"version"
    mojo version

List version information for installed core and optional modules, very useful for debugging.

ATTRIBUTES

Mojo::Commands inherits all attributes from Mojo::Command and implements the following new ones.

hint

    my $hint  = $commands->hint;
    $commands = $commands->hint('Foo!');

Short hint shown after listing available commands.

message

    my $message  = $commands->message;
    $commands    = $commands->message('Hello World!');

Short usage message shown before listing available commands.

namespaces

    my $namespaces = $commands->namespaces;
    $commands      = $commands->namespaces(['Mojo::Command']);

Namespaces to search for available commands, defaults to Mojo::Command.

METHODS

Mojo::Commands inherits all methods from Mojo::Command and implements the following new ones.

run

    $commands->run;
    $commands->run(@ARGV);

Load and run commands.

start

    Mojo::Commands->start;
    Mojo::Commands->start(@ARGV);

Start the command line interface.