X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=aa9892699c15f98742ec1064144aea95734f9809;hb=191665f3c88f4b1f81e4198717077ac08d06bdb7;hp=0e2fdbd23bae24606be1ba3f9056f36957296cbf;hpb=35b3434762d426e0cd5e04eb735291f8ca7ea08e;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 0e2fdbd..aa98926 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -118,7 +118,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90049_002'; +our $VERSION = '5.90049_003'; sub import { my ( $class, @arguments ) = @_; @@ -3165,15 +3165,17 @@ you really don't need to invoke it. =head2 default_data_handlers -Default Data Handler that come bundled with L. Currently there is -only one default data handler, for 'application/json'. This uses L -which uses the dependency free L OR L if you have -installed it. If you don't mind the XS dependency, you should add the faster -L to you dependency list (in your Makefile.PL or dist.ini, or -cpanfile, etc.) +Default Data Handlers that come bundled with L. Currently there is +only one default data handler, for 'application/json'. This is used to parse +incoming JSON into a Perl data structure. It used either L or +L, depending on which is installed. This allows you to fail back to +L, which is a Pure Perl JSON decoder, and has the smallest dependency +impact. -L is loaded the first time you ask for it (so if you never ask -for it, its never used). +Because we don't wish to add more dependencies to L, if you wish to +use this new feature we recommend installing L or L in +order to get the best performance. You should add either to your dependency +list (Makefile.PL, dist.ini, cpanfile, etc.) =cut @@ -3200,9 +3202,9 @@ sub default_data_handlers { my ($class) = @_; return +{ 'application/json' => sub { - local $/; - Class::Load::load_class("JSON::MaybeXS"); - JSON::MaybeXS::decode_json $_->getline }, + Class::Load::load_first_existing_class('JSON::MaybeXS', 'JSON') + ->can('decode_json')->(do { local $/; $_->getline }); + }, }; }