Catalyst-View-JSON
view release on metacpan or search on metacpan
Revision history for Perl extension Catalyst::View::JSON
0.37 - 2019-04-28
- fix Makefile.PL when current directory not in @INC (perl 5.26+)
- convert from Module::Install to Distar for release tooling
- Drop unneeded prerequisite on YAML
0.36 Wed Nov 25 12:00:00 CT 2015
- POD updates, improved warning messages, strictness (andyjack++)
- Make the default BOM added for safari optional. Possible breaking
change, please file issues if this causes trouble.
- New render method to let you just get a JSON encoded version of
some data (Added to make compatible with the unofficial Catalyst
View API that has a render method).
-
0.35 Wed Jan 07 12:00:00 CT 2014
- Specify a version of JSON::MaybXS in the Makefile to close a test
failure (test case requires version '1.003000' so we made that the
required version).
pass arguments to JSON::MaybeXS. Useful for when you want to have
more control on how your JSON serializer works.
0.33 Tue Apr 12 12:20:22 PDT 2011
- Fixed local_request monkey patching to support Catalyst >= 5.89
0.32 Tue Jan 4 10:03:05 PST 2011
- remove Opera special casing (omega)
0.31 Wed Sep 15 15:14:33 PDT 2010
- Chrome doesn't like UTF-8 BOM (Larry Leszczynski)
0.30 Tue Apr 13 01:14:07 CEST 2010
- Fix test application to call $c->forward('View::JSON') rather than
(the incorrect) $c->forward('MyApp::View::JSON')
- Fix documentation to match the above change
- Turn off the regex fallback behavior in the test applications on
newer Catalyst versions to ensure tests are correctly forwarding.
- Move actions out of the test application classes into controller
classes to avoid deprecation warnings on newer Catalyst releases.
- 0.29 had unintended commits accidentally pulled from ap/master. Reverted
- Added JSON::Any dependency
0.15 Fri Apr 13 19:25:04 PDT 2007
- Switch to use JSON::Any to abstract JSON drivers imlementations
(Thanks to Florian Ragwitz for the patch)
0.14 Wed Dec 20 17:20:26 PST 2006
- Oops, no_x_json_header in 0.13 was broken
0.13 Wed Dec 20 17:12:32 PST 2006
- Added UTF-8 BOM if the User-Agent is Safari and encoding is utf-8 (Jun Kuriyama)
- Added 'no_x_json_header' option to disable auto-setting X-JSON for Prototype.js
(Jun Kuriyama)
- Documented json_driver config
0.12 Thu Oct 26 17:37:58 JST 2006
- Support X-JSON for Prototype.js (John Wang)
- Updated interoperability doc (John Wang)
0.11 Mon Jul 31 16:21:14 JST 2006
- Fix validator so 'json_driver' should just work (Thanks to typester)
By default this plugin sets X-JSON header if the requested client is
a Prototype.js with X-JSON support. By setting 1, you can opt-out
this behavior so that you can do eval() by your own. Defaults to 0.
json_encoder_args
An optional hashref that supplies arguments to JSON::MaybeXS used
when creating a new object.
use_force_bom
If versions of this view older than 0.36, there was some code that
added a UTF-8 BOM marker to the end of the JSON string when the user
agent was Safari. After looking at a lot of existing code I don't
think this is needed anymore so we removed it by default. However if
this turns out to be a problem you can re enable it by setting this
attribute to true. Possible a breaking change so we offer this
workaround.
You may also override the method 'user_agent_bom_test' which
received the current request user agent string to try and better
determine if this is needed. Patches for this welcomed.
lib/Catalyst/View/JSON.pm view on Meta::CPAN
$c->res->content_type("application/json; charset=$encoding");
if ($c->req->header('X-Prototype-Version') && !$self->no_x_json_header) {
$c->res->header('X-JSON' => 'eval("("+this.transport.responseText+")")');
}
my $json = $self->render($c, $data);
my $output;
## add UTF-8 BOM if the client meets a test and the application wants it.
if ($self->use_force_bom && $encoding eq 'utf-8') {
my $user_agent = $c->req->user_agent || '';
if ($self->user_agent_bom_test($user_agent)) {
$output = "\xEF\xBB\xBF";
}
}
$output .= "$cb(" if $cb;
$output .= $json;
$output .= ");" if $cb;
lib/Catalyst/View/JSON.pm view on Meta::CPAN
Prototype.js with X-JSON support. By setting 1, you can opt-out this
behavior so that you can do eval() by your own. Defaults to 0.
=item json_encoder_args
An optional hashref that supplies arguments to L<JSON::MaybeXS> used when creating
a new object.
=item use_force_bom
If versions of this view older than 0.36, there was some code that added a UTF-8 BOM
marker to the end of the JSON string when the user agent was Safari. After looking
at a lot of existing code I don't think this is needed anymore so we removed it by
default. However if this turns out to be a problem you can re enable it by setting
this attribute to true. Possible a breaking change so we offer this workaround.
You may also override the method 'user_agent_bom_test' which received the current
request user agent string to try and better determine if this is needed. Patches
for this welcomed.
=back
( run in 0.387 second using v1.01-cache-2.11-cpan-e9daa2b36ef )