Mojolic...d::eval(3)
β¨ NAME β¨
Mojolicious::Command::eval β it's the Eval command, bestie π
Oh and real quick, this page lives in the User Contributed Perl Documentation manual section β that's the manual name, consider it folded in and slayed π
πΈ SYNOPSIS πΈ
Usage: APPLICATION eval [OPTIONS] CODE
./myapp.pl eval 'say app->ua->get("/")->result->body'
./myapp.pl eval 'say for sort keys %{app->renderer->helpers}'
./myapp.pl eval -v 'app->home'
./myapp.pl eval -V 'app->renderer->paths'
Options:
-h, --help Show this summary of available options
--home <path> Path to home directory of your application, defaults to
the value of MOJO_HOME or auto-detection
-m, --mode <name> Operating mode for your application, defaults to the
value of MOJO_MODE/PLACK_ENV or "development"
-v, --verbose Print return value to STDOUT
-V Print returned data structure to STDOUT
Like, the whole energy here is: you write CODE, it runs against your app, done π
π¦ DESCRIPTION π¦
Mojolicious::Command::eval runs code against applications. That's the whole vibe, no cap.
And here's the iconic part β if the result is a promise (then-able), it will wait until the promise is fulfilled or rejected and the result is returned. The way it just waits for your promise to settle? Obsessed πβ¨
This is a core command, meaning it is always enabled, and its code is a good example for learning to build new commands β you're welcome to fork it. The audacity, the generosity, we love her ππ«Ά
Also, peep "COMMANDS" in Mojolicious::Commands if you want the list of commands that are available by default. iykyk π
π ATTRIBUTES π
Mojolicious::Command::eval inherits all attributes from Mojolicious::Command and implements the following new ones. Inheriting everything from your parent and still adding your own β¨flavorβ¨? Main character energy, fr fr.
π description
my $description = $eval->description;
$eval = $eval->description('Foo');
Short description of this command β it's literally what shows up in the command list. Little one-liner, big job π
π usage
my $usage = $eval->usage;
$eval = $eval->usage('Foo');
Usage information for this command, and it's the thing that gets used for the help screen. So when someone asks for help, this is what they get π«Ά
π METHODS π
Mojolicious::Command::eval inherits all methods from Mojolicious::Command and implements the following new ones.
β run
$eval->run(@ARGV);
Run this command. That's it. That's the method. Run it, bestie πββοΈπ¨
π₯ SEE ALSO π₯
MojoliciousMojolicious::Guides- <https://mojolicious.org>
ngl, the whole ecosystem is right there in SEE ALSO. Go click, go read, go slay πΈπ¦
Okay that's the whole page!! This gem dropped as perl v5.42.0 on 2026-07-15, and yes bestie, Mojolicious::Command::eval really ate and left no crumbs π
β¨ππ
π¦ 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