Hi there!

Last night we released the second development version of Perl Catalyst "Hamburg", which is the current development release cycle. Highlights include fixes to the PSGI middleware integration that was release in 001 and a new ability to define custom request body data handlers so that you can graft into Catalyst the ability to parse PUT / POST request bodies other than the classic form-data and multipart. We also included one default body data parser to parse application/json, meaning that you no longer need additional modules to do basic JSON ajax with Catalyst. For example:

package TestDataHandlers::Controller::Root; use base 'Catalyst::Controller'; sub test_json :Local { my ($self, $c) = @_; $c->res->body($c->req->body_data->{message}); } 1;

Would define the controller and here's a test case:

use JSON::MaybeXS; ok my $message = 'helloworld'; ok my $post = encode_json +{message=>$message}; ok my $req = POST $c->uri_for_action('/test_json'), Content_Type => 'application/json', Content => $post; ok my $response = request $req, 'got a response from a catalyst controller'; is $response->content, $message, 'expected content body';

The new request method 'body_data' is lazy, so it won't attempt to parse anything unless you ask for it. Adding custom parsers is easy. You just add content type => parser subref to the Catalyst application, for example:

package MyApp::Web; use Catalyst; use JSON::MaybeXS; __PACKAGE__->config( data_handlers => { 'application/vnd.user+json' => sub { ## $_ is localized as a filehandle object of the PUT/POST request body local $/; decode_json $_->getline; }, }, ); __PACKAGE__->setup;

Body data parsers are global for now since this feature is not intended to compete with a full on approach like Catalyst::Action::REST. If the feature is useful, perhaps in the future we'll add the ability to let controllers define local body data parsers.

Unlike some frameworks, we purposefully distinguish between classic form parameters, which is certain to be key values, and body data, which is not (although often is, in the case of JSON AJAX use cases).

I want to thank everyone that participated in the email thread regarding how this might work.

Ok, so that's the new development release. Go on, download it, trying, complain now before it goes gold!

cpanm --dev Catalyst::Runtime

If you want to get involved with Catalyst Development, be sure to hangout on the Perl Catalyst IRC channels:

irc.perl.org#catalyst irc.perl.org#catalyst-dev

And check out the open quests over on Questhub:

http://questhub.io/realm/perl/explore/latest/tag/hamburg

I know contributing to Catalyst can feel daunting because the code is not the most accessible right now, but there's definitely a handful of small tasks that I'm certain a moderately aware programmer could handle with a bit of mentoring, as well as plenty of opportunity to test, blog and do general advocacy. So what's holding you back? Scared!? :) Go ahead, I dare you!

More to come... Jnap