in reply to REST Webservices and CGI.pm
CGI can still help you. You just need to make sure that the incoming data isn't regular form data:
I've used this successfully in a CGI::Application-based REST app -- at least for text/xml POST requests (I didn't test PUT yet, but I expect it to work the same way). I can heartily recommend CGI::Application::Dispatch, as it makes building RESTy APIs easier.HANDLING NON-URLENCODED ARGUMENTS If POSTed data is not of type application/x-www-form-urlencoded or multipart/form-data, then the POSTed data will not be processed, but instead be returned as-is in a parameter named POSTDATA. To retrieve it, use code like this: my $data = $query->param('POSTDATA'); (If you don't know what the preceding means, don't worry about it. It only affects people trying to use CGI for XML processing and other specialized tasks.)
I simply added a wrapper method in my base class:
My code can then choose to inflate that in any way it wants.sub get_request_body { my $self = shift; return $self->query->param('POSTDATA'); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: REST Webservices
by derby (Abbot) on Apr 12, 2007 at 12:28 UTC | |
by rhesa (Vicar) on Apr 12, 2007 at 12:53 UTC | |
by arbingersys (Pilgrim) on Nov 20, 2009 at 22:05 UTC | |
by jhourcle (Prior) on Apr 12, 2007 at 20:01 UTC |
In Section
Seekers of Perl Wisdom