package Mojo;
use Mojo::Base -strict;
# "Professor: These old Doomsday devices are dangerously unstable. I'll rest
# easier not knowing where they are."
1;
=encoding utf8
=head1 NAME
Mojo - Web development toolkit
=head1 SYNOPSIS
# 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('
Hello Mojo!
');
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;
=head1 DESCRIPTION
A powerful web development toolkit, with all the basic tools and helpers needed to write simple web applications and
higher level web frameworks, such as L. Some of the most commonly used tools are L,
L, L, L, L, L and L.
See L for more!
=head1 SEE ALSO
L, L, L.
=cut