NAME
Squatting::On::Catalyst - embed a Squatting app into a Catalyst app
SYNOPSIS
Add these 4 lines to your Catalyst app's Root Controller to embed a Squatting App.
use App 'On::Catalyst'
App->init;
App->relocate('/somewhere')
sub somewhere : Local { App->catalyze($_[1]) }
DESCRIPTION
The purpose of this module is to allow Squatting apps to be embedded inside Catalyst apps. This is done by adding a catalyze
method to the Squatting app that knows how to "translate" between Catalyst and Squatting. To use this module, pass the string 'On::Catalyst'
to the use
statement that loads your Squatting app.
API
All Your Framework Are Belong To Us
App->catalyze($c)
This method takes a Catalyst object, and uses the information it contains to let the Squatting app handle one HTTP request. First, it translates the Catalyst::Request object into terms Squatting can understand. Then it lets the Squatting app handle the request. Finally, it takes the Squatting app's output and populates the Catalyst::Response object. When this method is done, the Catalyst object should have everything it needs to send back a complete HTTP response.
NOTE: If you want to communicate something from the Catalyst app to the Squatting app, you can put data in $c->stash or $c->session before calling catalyze(). From inside a Squatting controller, these can be accessed via $self->v and $self->state. Squatting controllers also get access to Catalyst's logging object via $self->log.
In summary:
Catalyst Squatting
-------- ---------
$c->stash $self->v
$c->session $self->state
$c->log $self->log