X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=d16779b5a9292d4494c2dfaaabec19fca26d5b97;hp=2d3a3919e8f49691a8e5dc79d65df9ce4c68abc9;hb=a61b69837d86d115383621109faa3157af75ce91;hpb=88ba7793bb132b13ecea722fcc56313756a408b9 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2d3a391..d16779b 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -120,7 +120,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.90049_003'; +our $VERSION = '5.90049_006'; sub import { my ( $class, @arguments ) = @_; @@ -3167,12 +3167,15 @@ you really don't need to invoke it. =head2 default_data_handlers -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. +Default Data Handlers that come bundled with L. Currently there are +only two default data handlers, for 'application/json' and an alternative to +'application/x-www-form-urlencoded' which supposed nested form parameters via +L or via L IF you've installed it. + +The 'application/json' data handler 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. 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 @@ -3203,6 +3206,12 @@ sub setup_data_handlers { sub default_data_handlers { my ($class) = @_; return +{ + 'application/x-www-form-urlencoded' => sub { + my ($fh, $req) = @_; + my $params = $req->_use_hash_multivalue ? $req->body_parameters->mixed : $req->body_parameters; + Class::Load::load_first_existing_class('CGI::Struct::XS', 'CGI::Struct') + ->can('build_cgi_struct')->($params); + }, 'application/json' => sub { Class::Load::load_first_existing_class('JSON::MaybeXS', 'JSON') ->can('decode_json')->(do { local $/; $_->getline });