1Mojolicious::Commands(3U)ser Contributed Perl DocumentatiMoonjolicious::Commands(3)
2
3
4

NAME

6       Mojolicious::Commands - Command line interface
7

SYNOPSIS

9         Usage: APPLICATION COMMAND [OPTIONS]
10
11           mojo version
12           mojo generate lite_app
13           ./myapp.pl daemon -m production -l http://*:8080
14           ./myapp.pl get /foo
15           ./myapp.pl routes -v
16
17         Tip: CGI and PSGI environments can be automatically detected very often and
18              work without commands.
19
20         Options (for all commands):
21           -h, --help          Get more information on a specific command
22               --home <path>   Path to home directory of your application, defaults to
23                               the value of MOJO_HOME or auto-detection
24           -m, --mode <name>   Operating mode for your application, defaults to the
25                               value of MOJO_MODE/PLACK_ENV or "development"
26

DESCRIPTION

28       Mojolicious::Commands is the interactive command line interface for the
29       Mojolicious framework. It will automatically detect available commands
30       in the "Mojolicious::Command" and "Mojolicious::Command::Author"
31       namespaces.
32

COMMANDS

34       These commands are available by default.
35
36   cgi
37         $ ./myapp.pl cgi
38
39       Use Mojolicious::Command::cgi to start application with CGI backend,
40       usually auto detected.
41
42   cpanify
43         $ mojo cpanify -u sri -p secr3t Mojolicious-Plugin-Fun-0.1.tar.gz
44
45       Use Mojolicious::Command::Author::cpanify for uploading files to CPAN.
46
47   daemon
48         $ ./myapp.pl daemon
49
50       Use Mojolicious::Command::daemon to start application with standalone
51       HTTP and WebSocket server.
52
53   eval
54         $ ./myapp.pl eval 'say app->home'
55
56       Use Mojolicious::Command::eval to run code against application.
57
58   generate
59         $ mojo generate
60         $ mojo generate help
61         $ ./myapp.pl generate help
62
63       List available generator commands with short descriptions.
64
65         $ mojo generate help <generator>
66         $ ./myapp.pl generate help <generator>
67
68       List available options for generator command with short descriptions.
69
70   generate app
71         $ mojo generate app <AppName>
72
73       Use Mojolicious::Command::Author::generate::app to generate application
74       directory structure for a fully functional Mojolicious application.
75
76   generate lite_app
77         $ mojo generate lite_app
78
79       Use Mojolicious::Command::Author::generate::lite_app to generate a
80       fully functional Mojolicious::Lite application.
81
82   generate makefile
83         $ mojo generate makefile
84         $ ./myapp.pl generate makefile
85
86       Use Mojolicious::Command::Author::generate::makefile to generate
87       "Makefile.PL" file for application.
88
89   generate plugin
90         $ mojo generate plugin <PluginName>
91
92       Use Mojolicious::Command::Author::generate::plugin to generate
93       directory structure for a fully functional Mojolicious plugin.
94
95   get
96         $ mojo get https://mojolicious.org
97         $ ./myapp.pl get /foo
98
99       Use Mojolicious::Command::get to perform requests to remote host or
100       local application.
101
102   help
103         $ mojo
104         $ mojo help
105         $ ./myapp.pl help
106
107       List available commands with short descriptions.
108
109         $ mojo help <command>
110         $ ./myapp.pl help <command>
111
112       List available options for the command with short descriptions.
113
114   inflate
115         $ ./myapp.pl inflate
116
117       Use Mojolicious::Command::Author::inflate to turn templates and static
118       files embedded in the "DATA" sections of your application into real
119       files.
120
121   prefork
122         $ ./myapp.pl prefork
123
124       Use Mojolicious::Command::prefork to start application with standalone
125       pre-forking HTTP and WebSocket server.
126
127   psgi
128         $ ./myapp.pl psgi
129
130       Use Mojolicious::Command::psgi to start application with PSGI backend,
131       usually auto detected.
132
133   routes
134         $ ./myapp.pl routes
135
136       Use Mojolicious::Command::routes to list application routes.
137
138   version
139         $ mojo version
140         $ ./myapp.pl version
141
142       Use Mojolicious::Command::version to show version information for
143       available core and optional modules, very useful for debugging.
144

ATTRIBUTES

146       Mojolicious::Commands inherits all attributes from Mojolicious::Command
147       and implements the following new ones.
148
149   hint
150         my $hint  = $commands->hint;
151         $commands = $commands->hint('Foo');
152
153       Short hint shown after listing available commands.
154
155   message
156         my $msg   = $commands->message;
157         $commands = $commands->message('Hello World!');
158
159       Short usage message shown before listing available commands.
160
161   namespaces
162         my $namespaces = $commands->namespaces;
163         $commands      = $commands->namespaces(['MyApp::Command']);
164
165       Namespaces to load commands from, defaults to
166       "Mojolicious::Command::Author" and "Mojolicious::Command".
167
168         # Add another namespace to load commands from
169         push @{$commands->namespaces}, 'MyApp::Command';
170

METHODS

172       Mojolicious::Commands inherits all methods from Mojolicious::Command
173       and implements the following new ones.
174
175   detect
176         my $env = $commands->detect;
177
178       Try to detect environment, or return "undef" if none could be detected.
179
180   run
181         $commands->run;
182         $commands->run(@ARGV);
183
184       Load and run commands. Automatic deployment environment detection can
185       be disabled with the "MOJO_NO_DETECT" environment variable.
186
187   start_app
188         Mojolicious::Commands->start_app('MyApp');
189         Mojolicious::Commands->start_app(MyApp => @ARGV);
190
191       Load application from class and start the command line interface for
192       it. Note that the options "-h"/"--help", "--home" and "-m"/"--mode",
193       which are shared by all commands, will be parsed from @ARGV during
194       compile time.
195
196         # Always start daemon for application
197         Mojolicious::Commands->start_app('MyApp', 'daemon', '-l', 'http://*:8080');
198

SEE ALSO

200       Mojolicious, Mojolicious::Guides, <https://mojolicious.org>.
201
202
203
204perl v5.30.0                      2019-07-26          Mojolicious::Commands(3)
Impressum