HTML::ForumCode::Cookbook::Recipe1 - Catalyst Controller
package MyApp::Controller::ForumCode; # vim: ts=8 sts=4 et sw=4 sr sta use strict; use warnings; use parent 'Catalyst::Controller'; use JSON::Any; use HTML::ForumCode; sub preview : Local { my ($self, $c) = @_; my $tt_forum = HTML::ForumCode->new(); my $msg_source = $c->request->param('msg_source'); my $j = JSON::Any->new; my $json = $j->to_json( { 'formatted' => $tt_forum->forumcode( $msg_source ) } ); $c->response->body( $json ); return; } 1;
This recipe provides a Catalyst controller class that will take HTML::ForumCode markup via the msg_source parameter and return the formatted HTML in the formatted key of a JSON response.
Chisel Wright <chiselwright@users.berlios.de>
<chiselwright@users.berlios.de>
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install Template::Plugin::ForumCode, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Template::Plugin::ForumCode
CPAN shell
perl -MCPAN -e shell install Template::Plugin::ForumCode
For more information on module installation, please visit the detailed CPAN module installation guide.