chromatic is correct. From the docs:
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.
I'm not sure of all the curl command lines, but here's how I would test using
lwp-request -m PUT -c 'text/xml' -se 'http://localhost/cgi-bin/api.pl
+' < test.xml
One caveat though, it cannot be 'application/xml' either. For some reasons XForms
overreached and managed to grab that generic content-type and CGI
does some special processing for it.
update: And to properly handle PUTDATA, you need your CGI version to be greater that 3.30. That support was actually hacked our here in the monastery: REST Webservices and CGI.pm.