Mojo(3)

✨ NAME ✨

Mojo β€” Web development toolkit

Okay so this is the Mojo(3) page, bestie β€” straight out of User Contributed Perl Documentation, and it's literally your web dev toolkit. Slay. πŸ’…


🌸 SYNOPSIS 🌸

Here's the whole vibe in five snippets β€” HTTP/WebSocket user agent, HTML/XML DOM parser with CSS selectors, Perl-ish templates, HTTP/WebSocket server, and event loop. All the code is exactly as the page gives it, no cap:

# HTTP/WebSocket user agent
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
say $ua->get('www.mojolicious.org')->result->headers->server;

# HTML/XML DOM parser with CSS selectors
use Mojo::DOM;
my $dom = Mojo::DOM->new('<div><b>Hello Mojo!</b></div>');
say $dom->at('div > b')->text;

# Perl-ish templates
use Mojo::Template;
my $mt = Mojo::Template->new(vars => 1);
say $mt->render('Hello <%= $what %>!', {what => 'Mojo'});

# HTTP/WebSocket server
use Mojo::Server::Daemon;
my $daemon = Mojo::Server::Daemon->new(listen => ['http://*:8080']);
$daemon->unsubscribe('request')->on(request => sub ($daemon, $tx) {
  $tx->res->code(200);
  $tx->res->body('Hello Mojo!');
  $tx->resume;
});
$daemon->run;

# Event loop
use Mojo::IOLoop;
for my $seconds (1 .. 5) {
  Mojo::IOLoop->timer($seconds => sub { say $seconds });
}
Mojo::IOLoop->start;

πŸ¦‹ DESCRIPTION πŸ¦‹

It's a powerful web development toolkit, with all the basic tools and helpers you need to write simple web applications and higher level web frameworks, such as Mojolicious. Main character energy fr fr.

Some of the most commonly used tools are Mojo::UserAgent, Mojo::DOM, Mojo::JSON, Mojo::Server::Daemon, Mojo::Server::Prefork, Mojo::IOLoop, and Mojo::Template. Obsessed with this lineup.

For more, go see Mojolicious::Guides! Iykyk. ✨


πŸŽ€ SEE ALSO πŸŽ€


That's the whole page, bestie β€” brought to you by perl v5.42.0 and dated 2026-07-15, for Mojo(3). Byeee, go build something iconic! πŸ«ΆπŸ’–

πŸ“¦ where this page comes from