Squatting::On::Catalyst - embed a Squatting app into a Catalyst app
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]) }
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.
catalyze
'On::Catalyst'
use
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
Catalyst, Catalyst::Request, Catalyst::Response
To install Squatting, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Squatting
CPAN shell
perl -MCPAN -e shell install Squatting
For more information on module installation, please visit the detailed CPAN module installation guide.