Template-Plugin-ForumCode/lib/HTML/ForumCode/Cookbook/Recipe1.pod
=pod
=head1 NAME
HTML::ForumCode::Cookbook::Recipe1 - Catalyst Controller
=head1 SYNOPSIS
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;
=head1 DESCRIPTION
This recipe provides a L<Catalyst> controller class that will take
L<HTML::ForumCode> markup via the I<msg_source> parameter and return the
formatted HTML in the I<formatted> key of a JSON response.
=head1 AUTHOR
Chisel Wright C<< <chiselwright@users.berlios.de> >>
=head1 LICENSE
This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.
=cut