.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Mojolicious::Commands 3pm" .TH Mojolicious::Commands 3pm 2024-05-15 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Mojolicious::Commands \- Command line interface .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& Usage: APPLICATION COMMAND [OPTIONS] \& \& mojo version \& mojo generate lite\-app \& ./myapp.pl daemon \-m production \-l http://*:8080 \& ./myapp.pl get /foo \& ./myapp.pl routes \-v \& \& Tip: CGI and PSGI environments can be automatically detected very often and \& work without commands. \& \& Options (for all commands): \& \-h, \-\-help Get more information on a specific command \& \-\-home Path to home directory of your application, defaults to \& the value of MOJO_HOME or auto\-detection \& \-m, \-\-mode Operating mode for your application, defaults to the \& value of MOJO_MODE/PLACK_ENV or "development" .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Mojolicious::Commands is the interactive command line interface for the Mojolicious framework. It will automatically detect available commands in the \f(CW\*(C`Mojolicious::Command\*(C'\fR and \f(CW\*(C`Mojolicious::Command::Author\*(C'\fR namespaces. .SH COMMANDS .IX Header "COMMANDS" These commands are available by default. .SS cgi .IX Subsection "cgi" .Vb 1 \& $ ./myapp.pl cgi .Ve .PP Use Mojolicious::Command::cgi to start application with CGI backend, usually auto detected. .SS cpanify .IX Subsection "cpanify" .Vb 1 \& $ mojo cpanify \-u sri \-p secr3t Mojolicious\-Plugin\-Fun\-0.1.tar.gz .Ve .PP Use Mojolicious::Command::Author::cpanify for uploading files to CPAN. .SS daemon .IX Subsection "daemon" .Vb 1 \& $ ./myapp.pl daemon .Ve .PP Use Mojolicious::Command::daemon to start application with standalone HTTP and WebSocket server. .SS eval .IX Subsection "eval" .Vb 1 \& $ ./myapp.pl eval \*(Aqsay app\->home\*(Aq .Ve .PP Use Mojolicious::Command::eval to run code against application. .SS generate .IX Subsection "generate" .Vb 3 \& $ mojo generate \& $ mojo generate help \& $ ./myapp.pl generate help .Ve .PP List available generator commands with short descriptions. .PP .Vb 2 \& $ mojo generate help \& $ ./myapp.pl generate help .Ve .PP List available options for generator command with short descriptions. .SS "generate app" .IX Subsection "generate app" .Vb 1 \& $ mojo generate app .Ve .PP Use Mojolicious::Command::Author::generate::app to generate application directory structure for a fully functional Mojolicious application. .SS "generate dockerfile" .IX Subsection "generate dockerfile" .Vb 2 \& $ ./myapp.pl generate dockerfile \& $ ./script/my_app generate dockerfile .Ve .PP Use Mojolicious::Command::Author::generate::dockerfile to generate \f(CW\*(C`Dockerfile\*(C'\fR for application. .SS "generate lite-app" .IX Subsection "generate lite-app" .Vb 1 \& $ mojo generate lite\-app .Ve .PP Use Mojolicious::Command::Author::generate::lite_app to generate a fully functional Mojolicious::Lite application. .SS "generate makefile" .IX Subsection "generate makefile" .Vb 2 \& $ mojo generate makefile \& $ ./myapp.pl generate makefile .Ve .PP Use Mojolicious::Command::Author::generate::makefile to generate \f(CW\*(C`Makefile.PL\*(C'\fR file for application. .SS "generate plugin" .IX Subsection "generate plugin" .Vb 1 \& $ mojo generate plugin .Ve .PP Use Mojolicious::Command::Author::generate::plugin to generate directory structure for a fully functional Mojolicious plugin. .SS get .IX Subsection "get" .Vb 2 \& $ mojo get https://mojolicious.org \& $ ./myapp.pl get /foo .Ve .PP Use Mojolicious::Command::get to perform requests to remote host or local application. .SS help .IX Subsection "help" .Vb 3 \& $ mojo \& $ mojo help \& $ ./myapp.pl help .Ve .PP List available commands with short descriptions. .PP .Vb 2 \& $ mojo help \& $ ./myapp.pl help .Ve .PP List available options for the command with short descriptions. .SS inflate .IX Subsection "inflate" .Vb 1 \& $ ./myapp.pl inflate .Ve .PP Use Mojolicious::Command::Author::inflate to turn templates and static files embedded in the \f(CW\*(C`DATA\*(C'\fR sections of your application into real files. .SS prefork .IX Subsection "prefork" .Vb 1 \& $ ./myapp.pl prefork .Ve .PP Use Mojolicious::Command::prefork to start application with standalone pre-forking HTTP and WebSocket server. .SS psgi .IX Subsection "psgi" .Vb 1 \& $ ./myapp.pl psgi .Ve .PP Use Mojolicious::Command::psgi to start application with PSGI backend, usually auto detected. .SS routes .IX Subsection "routes" .Vb 1 \& $ ./myapp.pl routes .Ve .PP Use Mojolicious::Command::routes to list application routes. .SS version .IX Subsection "version" .Vb 2 \& $ mojo version \& $ ./myapp.pl version .Ve .PP Use Mojolicious::Command::version to show version information for available core and optional modules, very useful for debugging. .SH ATTRIBUTES .IX Header "ATTRIBUTES" Mojolicious::Commands inherits all attributes from Mojolicious::Command and implements the following new ones. .SS hint .IX Subsection "hint" .Vb 2 \& my $hint = $commands\->hint; \& $commands = $commands\->hint(\*(AqFoo\*(Aq); .Ve .PP Short hint shown after listing available commands. .SS message .IX Subsection "message" .Vb 2 \& my $msg = $commands\->message; \& $commands = $commands\->message(\*(AqHello World!\*(Aq); .Ve .PP Short usage message shown before listing available commands. .SS namespaces .IX Subsection "namespaces" .Vb 2 \& my $namespaces = $commands\->namespaces; \& $commands = $commands\->namespaces([\*(AqMyApp::Command\*(Aq]); .Ve .PP Namespaces to load commands from, defaults to \f(CW\*(C`Mojolicious::Command::Author\*(C'\fR and \f(CW\*(C`Mojolicious::Command\*(C'\fR. .PP .Vb 2 \& # Add another namespace to load commands from \& push @{$commands\->namespaces}, \*(AqMyApp::Command\*(Aq; .Ve .SH METHODS .IX Header "METHODS" Mojolicious::Commands inherits all methods from Mojolicious::Command and implements the following new ones. .SS detect .IX Subsection "detect" .Vb 1 \& my $env = $commands\->detect; .Ve .PP Try to detect environment, or return \f(CW\*(C`undef\*(C'\fR if none could be detected. .SS run .IX Subsection "run" .Vb 2 \& $commands\->run; \& $commands\->run(@ARGV); .Ve .PP Load and run commands. Automatic deployment environment detection can be disabled with the \f(CW\*(C`MOJO_NO_DETECT\*(C'\fR environment variable. .SS start_app .IX Subsection "start_app" .Vb 2 \& Mojolicious::Commands\->start_app(\*(AqMyApp\*(Aq); \& Mojolicious::Commands\->start_app(MyApp => @ARGV); .Ve .PP Load application from class and start the command line interface for it. Note that the options \f(CW\*(C`\-h\*(C'\fR/\f(CW\*(C`\-\-help\*(C'\fR, \&\f(CW\*(C`\-\-home\*(C'\fR and \f(CW\*(C`\-m\*(C'\fR/\f(CW\*(C`\-\-mode\*(C'\fR, which are shared by all commands, will be parsed from \f(CW@ARGV\fR during compile time. .PP .Vb 2 \& # Always start daemon for application \& Mojolicious::Commands\->start_app(\*(AqMyApp\*(Aq, \*(Aqdaemon\*(Aq, \*(Aq\-l\*(Aq, \*(Aqhttp://*:8080\*(Aq); .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" Mojolicious, Mojolicious::Guides, .