Mojolic...:prefork(3)
π Mojolicious::Command::prefork
okay so bestie, you're reading the prefork man page β it lives in section 3 of the User Contributed Perl Documentation, and it's genuinely one of the most useful little gremlins in the whole Mojolicious toolbox. let's get into it π«Ά
β¨ NAME β¨
Mojolicious::Command::prefork β the Pre-fork command. that's it, that's the name, she's literally named what she does π
π SYNOPSIS π
the vibe check, in code:
Usage: APPLICATION prefork [OPTIONS]
and here's how the girlies actually run it:
./myapp.pl prefork
./myapp.pl prefork -m production -p -l http://*:8080
./myapp.pl prefork -l http://127.0.0.1:8080 -l https://[::]:8081
./myapp.pl prefork -l 'https://*:443?cert=./server.crt&key=./server.key'
./myapp.pl prefork -l http+unix://%2Ftmp%2Fmyapp.sock -w 12
./myapp.pl prefork -l http://127.0.0.1:8080 -p 127.0.0.0/8 -p fc00::/7
β Options β
every single flag, no gatekeeping, no cap:
-a,--accepts <number>β how many connections each worker will accept. defaults to10000.-b,--backlog <size>β listen backlog size. defaults toSOMAXCONN.-c,--clients <number>β max number of concurrent connections. defaults to1000.-G,--graceful-timeout <seconds>β graceful timeout. defaults to120.(yes the period is right there in the original, respect her punctuation π).-I,--heartbeat-interval <seconds>β heartbeat interval. defaults to5.-H,--heartbeat-timeout <seconds>β heartbeat timeout. defaults to50.-h,--helpβ show this summary of available options. the classic.--home <path>β path to the home directory of your application. defaults to the value ofMOJO_HOMEor auto-detection.-i,--inactivity-timeout <seconds>β inactivity timeout. defaults to the value ofMOJO_INACTIVITY_TIMEOUTor30.-k,--keep-alive-timeout <seconds>β keep-alive timeout. defaults to the value ofMOJO_KEEP_ALIVE_TIMEOUTor5.-l,--listen <location>β one or more locations you want to listen on. defaults to the value ofMOJO_LISTENor"http://*:3000".-m,--mode <name>β operating mode for your application. defaults to the value ofMOJO_MODE/PLACK_ENVor"development".-P,--pid-file <path>β path to the process id file. defaults to"prefork.pid"in a temporary directory.-p,--proxy [<network>]β activate reverse proxy support. defaults to the value ofMOJO_REVERSE_PROXY, and optionally takes one or more trusted proxy addresses or networks.-r,--requests <number>β max number of requests per keep-alive connection. defaults to100.-s,--spare <number>β temporarily spawn up to this number of additional workers. defaults to2.-w,--workers <number>β number of workers. defaults to4.
π¦ DESCRIPTION π¦
so Mojolicious::Command::prefork starts applications with the Mojo::Server::Prefork backend. that's the whole assignment, and she ate π₯
this is a core command, which means it is always enabled β and its code is a genuinely good example for learning to build new commands. you're welcome to fork it, like literally, forking is the whole theme here π§
also: see "COMMANDS" in Mojolicious::Commands for a list of commands that are available by default. iykyk.
π ATTRIBUTES π
Mojolicious::Command::prefork inherits all attributes from Mojolicious::Command and implements the following new ones. family traits, but make it fresh β¨
π description
my $description = $prefork->description;
$prefork = $prefork->description('Foo');
short description of this command, used for the command list. it's her little one-liner in the group chat bio π
π usage
my $usage = $prefork->usage;
$prefork = $prefork->usage('Foo');
usage information for this command, used for the help screen. the "how do i use this" text, basically.
π METHODS π
Mojolicious::Command::prefork inherits all methods from Mojolicious::Command and implements the following new ones. the icon legacy continues π
πΈ build_server
my $server = $daemon->build_server(@ARGV);
build Mojo::Server::Prefork instance from command line arguments. that's the main character move right there π
πΈ run
$prefork->run(@ARGV);
run this command. short, sweet, slays.
π SEE ALSO π
MojoliciousMojolicious::Guides- <https://mojolicious.org>
go read them, bestie, they're free and they're iconic π
ngl this whole page is core-command energy: always on, always available, and a great template if you ever wanna fork it and build your own. no cap π«Ά
later, legend β¨ this was perl v5.42.0, dated 2026-07-15, and that's the whole Mojolic...:prefork(3) situation β mwah π
π¦ where this page comes from
- opensuse-leap 16.0: perl-Mojolicious 9.480.0-bp160.2.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms