_json ($data)
Output the JSON-encoded I<$data>, set the content type to "application/json",
and abort. e.g.
method handle {
my $data;
# compute data somehow
$m->send_json
($data);
}
C<send_json> is a shortcut for
$m->clear_buffer;
$m->print(JSON::XS::encode_json($data));
$m->res->content_type("application/json");
$m->abort();
=back
=head1 SEE AL
RSION = '0.13';
}
use Mason::PluginRole;
use Poet qw($conf $poet);
use Poet::Plack::Response;
use JSON::XS;
use Try::Tiny;
has 'req' => ( is => 'ro', required => 1, isa => 'Object' );
has 'res' => (
elf->req->session;
}
method send_json ($data) {
$self->clear_buffer;
$self->print( JSON::XS::encode_json($data) );
$self->res->content_type("application/json");
$self->abort();
}
1;
:Log;
BEGIN {
$Poet::t::Log::VERSION = '0.13';
}
use Poet::Tools qw(rmtree tempdir_simple);
use JSON::XS;
use Test::Class::Most parent => 'Poet::Test::Class';
__PACKAGE__->initialize_temp_env();
s
my $log_conf = Poet::Log->generate_log4perl_config();
is( $log_conf, $expected, encode_json($conf_settings) );
};
my $default_layout = "%d{dd/MMM/yyyy:HH:mm:ss.SS} [%p] %c - %m - %