Hello and Thank You for the reply.

From the embperl documentation: " (Embperl uses CGI.pm internally to process forms encoded with multipart/form-data.)"

Does embperl convert "Content-Type: application/json" to "multipart/form-data"?


Does embperl  also use CGI.pm to populate %fdat?

In my script I am just using %fdat.  I am not loading nor using CGI.pm.   Any documentation that I have seen online refer to embperl and CGI.pm as separate, so unless I load CGI.pm or use "multipart/form-data" it should be a different issue.   Am I missing something?

Thank You,

On 4/2/2015 4:44 AM, Frank Wesemann wrote:
This is more a problem of CGI.pm ( which Embperl uses under the hood ).
may help you.

2015-03-30 18:58 GMT+02:00 Donavon <donl@mycopanet.com>:

I am creating an ajax call to an embperl script and I need assistance in getting the script to work with json data sent with "application/json"

It works when I send data via javascript with:
  request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

It doesn't work when I send data via javascript with:
  request.setRequestHeader("Content-Type", "application/json");

My submit form looks like this:

use JSON; # imports encode_json, decode_json, to_json and from_json.

$fdat{test}  = "test";
$json        = encode_json(\%fdat);

$escmode = 0;
$http_headers_out{'Content-Type'}         = "application/json; charset=utf-8";
print OUT $json;

Thank You,

To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org

mit freundlichem Gruß,

Frank Wesemann
Fotofinder GmbH         USt-IdNr. DE812854514
Software Entwicklung    Web: http://www.fotofinder.com/
Potsdamer Str. 96       Tel: +49 30 25 79 28 90
10785 Berlin            Fax: +49 30 25 79 28 999

Sitz: Berlin
Amtsgericht Berlin Charlottenburg (HRB 73099)
Geschäftsführer: Ali Paczensky