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 πŸ”₯


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