use Plack::Middleware::IIS7KeepAliveFix;
use Plack::Middleware::LighttpdScriptNameFix;
use Plack::Util;
-use JSON::MaybeXS qw(decode_json);
+use Class::Load;
BEGIN { require 5.008003; }
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.90049_001';
+our $VERSION = '5.90049_002';
sub import {
my ( $class, @arguments ) = @_;
my @middleware = map {
ref $_ eq 'CODE' ?
"Inline Coderef" :
- (ref($_) .' '. ($_->can('VERSION') ? $_->VERSION : '')
+ (ref($_) .' '. ($_->can('VERSION') ? $_->VERSION || '' : '')
|| '') } $class->registered_middlewares;
if (@middleware) {
$class->log->debug( "Loaded PSGI Middleware:\n" . $t->draw . "\n" );
}
- my %dh = $class->registered_data_handlers || ();
- my @data_handlers = keys %dh;
-
- if (@data_handlers) {
+ my %dh = $class->registered_data_handlers;
+ if (my @data_handlers = keys %dh) {
my $column_width = Catalyst::Utils::term_width() - 6;
my $t = Text::SimpleTable->new($column_width);
$t->row($_) for @data_handlers;
L<Cpanel::JSON::XS> to you dependency list (in your Makefile.PL or dist.ini, or
cpanfile, etc.)
+L<JSON::MaybeXS> is loaded the first time you ask for it (so if you never ask
+for it, its never used).
+
=cut
sub registered_data_handlers {
sub default_data_handlers {
my ($class) = @_;
return +{
- 'application/json' => sub { local $/; decode_json $_->getline },
+ 'application/json' => sub {
+ local $/;
+ Class::Load::load_class("JSON::MaybeXS");
+ JSON::MaybeXS::decode_json $_->getline },
};
}