The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Squatting::On::Mojo - squat on top of Mojo

SYNOPSIS

First, Create a Mojo app:

mojo generate app Foo

Then, Embed a Squatting app Into It:

cd foo
$EDITOR lib/Foo.pm

use Pod::Server 'On::Mojo';
Pod::Server->init;

sub handler {
  my ($self, $tx) = @_;
  Pod::Server->mojo($self, $tx);
  $tx;
}

DESCRIPTION

The purpose of this module is to allow Squatting apps to be embedded inside Mojo apps. This is done by adding a mojo method to the Squatting app that knows how to translate between Mojo and Squatting. To use this module, pass the string 'On::Mojo' to the use statement that loads your Squatting app.

API

Refinements based on lessons learned from Catalyst

App->mojo($mojo, $tx)

Calling the mojo method will let the Squatting app handle the request. The $tx should have its Mojo::Message::Response object populated by Squatting, and $tx should be ready to return when finished.

SEE ALSO

Mojo, Catalyst, Squatting::On::Catalyst, Pod::Server

AUTHOR

John Beppu <beppu@cpan.org>