Mailing List Archive

embperl and JSON
Hello.

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");
request.send(encodeURLQueryString(data));

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


My submit form looks like this:

submit.epl
[.-
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,
~Donavon

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: embperl and JSON [ In reply to ]
This is more a problem of CGI.pm ( which Embperl uses under the hood ).
http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json
may help you.

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

> Hello.
>
> 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");
> request.send(encodeURLQueryString(data));
>
> It doesn't work when I send data via javascript with:
> request.setRequestHeader("Content-Type", "application/json");
> request.send(JSON.stringify(data));
>
>
> My submit form looks like this:
>
> submit.epl
> [.-
> 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,
> ~Donavon
>
> ---------------------------------------------------------------------
> 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
Re: embperl and JSON [ In reply to ]
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"?

or

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,
~Donavon




On 4/2/2015 4:44 AM, Frank Wesemann wrote:
> This is more a problem of CGI.pm ( which Embperl uses under the hood ).
> http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json
> may help you.
>
> 2015-03-30 18:58 GMT+02:00 Donavon <donl@mycopanet.com
> <mailto:donl@mycopanet.com>>:
>
> Hello.
>
> 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");
> request.send(encodeURLQueryString(data));
>
> It doesn't work when I send data via javascript with:
> request.setRequestHeader("Content-Type", "application/json");
> request.send(JSON.stringify(data));
>
>
> My submit form looks like this:
>
> submit.epl
> [.-
> 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,
> ~Donavon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> <mailto:embperl-unsubscribe@perl.apache.org>
> For additional commands, e-mail: embperl-help@perl.apache.org
> <mailto: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
AW: embperl and JSON [ In reply to ]
Hi,
















Embperl use CGI.pm only for multipart/formdata.
















encode_json excepts the raw data, while %fdat already has splited them into name/values pairs.
















You need to set

optDisableFormData = 256 in EMBPERL_OPTIONS and read in the posted data on your own
















Regards
















Gerald





























Von:


Donavon [mailto:donl@mycopanet.com]


Gesendet:
Donnerstag, 2. April 2015 18:44


An:
Frank Wesemann


Cc:
embperl@perl.apache.org


Betreff:
Re: embperl and JSON

















Hello and Thank You for the reply.



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



Does embperl convert &quot;Content-Type: application/json&quot; to &quot;multipart/form-data&quot;?



or



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 &quot;multipart/form-data&quot; it should be a different issue.
Am I missing something?



Thank You,

~Donavon














On 4/2/2015 4:44 AM, Frank Wesemann wrote:









This is more a problem of CGI.pm ( which Embperl uses under the hood ).







http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json









may help you.


















2015-03-30 18:58 GMT+02:00 Donavon &lt;
donl@mycopanet.com
&gt;:






Hello.



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 &quot;application/json&quot;



It works when I send data via javascript with:


request.setRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);


request.send(encodeURLQueryString(data));



It doesn't work when I send data via javascript with:


request.setRequestHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);


request.send(JSON.stringify(data));





My submit form looks like this:



submit.epl

[.-

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



$fdat{test}
= &quot;test&quot;;

$json



= encode_json(\%fdat);



$escmode = 0;

$http_headers_out{'Content-Type'}




= &quot;application/json; charset=utf-8&quot;;

print OUT $json;

-]





Thank You,

~Donavon



---------------------------------------------------------------------

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

















!DSPAM:416,551d72ba23601775725073!
Re: AW: embperl and JSON [ In reply to ]
Thank You.

How can this be set for a single embperl .epl file?

I only need to process JSON in one file and leave the fdat processing
normal for the hundreds of other files.

Thank You,
~Donavon

On 4/8/2015 3:52 AM, richter@ecos.de wrote:
>
> Hi,
>
> Embperl use CGI.pm only for multipart/formdata.
>
> encode_json excepts the raw data, while %fdat already has splited them
> into name/values pairs.
>
> You need to set optDisableFormData = 256 in EMBPERL_OPTIONS and read
> in the posted data on your own
>
> Regards
>
> Gerald
>
> *Von:*Donavon [mailto:donl@mycopanet.com]
> *Gesendet:* Donnerstag, 2. April 2015 18:44
> *An:* Frank Wesemann
> *Cc:* embperl@perl.apache.org
> *Betreff:* Re: embperl and JSON
>
> 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"?
>
> or
>
> 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,
> ~Donavon
>
>
>
> On 4/2/2015 4:44 AM, Frank Wesemann wrote:
>
> This is more a problem of CGI.pm ( which Embperl uses under the
> hood ).
>
> http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json
>
> may help you.
>
> 2015-03-30 18:58 GMT+02:00 Donavon <donl@mycopanet.com
> <mailto:donl@mycopanet.com>>:
>
> Hello.
>
> 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");
> request.send(encodeURLQueryString(data));
>
> It doesn't work when I send data via javascript with:
> request.setRequestHeader("Content-Type", "application/json");
> request.send(JSON.stringify(data));
>
>
> My submit form looks like this:
>
> submit.epl
> [.-
> 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,
> ~Donavon
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> <mailto:embperl-unsubscribe@perl.apache.org>
> For additional commands, e-mail: embperl-help@perl.apache.org
> <mailto: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
>
>
>
> !DSPAM:416,551d72ba23601775725073!
>
Re: AW: embperl and JSON [ In reply to ]
Hi Donavon

I love embperl as much as anyone, but I'm not sure this is a job for it
really - are you able to use a regular cgi script instead? Maybe consider
this unless you are actually embedding the perl in to something.

Michael


On Thu, Apr 9, 2015 at 10:09 PM, Donavon <donl@mycopanet.com> wrote:

> Thank You.
>
> How can this be set for a single embperl .epl file?
>
> I only need to process JSON in one file and leave the fdat processing
> normal for the hundreds of other files.
>
> Thank You,
> ~Donavon
>
> On 4/8/2015 3:52 AM, richter@ecos.de wrote:
>
> Hi,
>
>
>
> Embperl use CGI.pm only for multipart/formdata.
>
>
>
> encode_json excepts the raw data, while %fdat already has splited them
> into name/values pairs.
>
>
>
> You need to set optDisableFormData = 256 in EMBPERL_OPTIONS and read in
> the posted data on your own
>
>
>
> Regards
>
>
>
> Gerald
>
>
>
>
>
> *Von:* Donavon [mailto:donl@mycopanet.com <donl@mycopanet.com>]
> *Gesendet:* Donnerstag, 2. April 2015 18:44
> *An:* Frank Wesemann
> *Cc:* embperl@perl.apache.org
> *Betreff:* Re: embperl and JSON
>
>
>
> 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"?
>
> or
>
> 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,
> ~Donavon
>
>
>
> On 4/2/2015 4:44 AM, Frank Wesemann wrote:
>
> This is more a problem of CGI.pm ( which Embperl uses under the hood ).
>
>
> http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json
>
> may help you.
>
>
>
> 2015-03-30 18:58 GMT+02:00 Donavon <donl@mycopanet.com>:
>
> Hello.
>
> 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");
> request.send(encodeURLQueryString(data));
>
> It doesn't work when I send data via javascript with:
> request.setRequestHeader("Content-Type", "application/json");
> request.send(JSON.stringify(data));
>
>
> My submit form looks like this:
>
> submit.epl
> [.-
> 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,
> ~Donavon
>
> ---------------------------------------------------------------------
> 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
>
>
>
> !DSPAM:416,551d72ba23601775725073!
>
>
>
AW: AW: embperl and JSON [ In reply to ]
Put it in a &lt;Files &gt; &lt;/Files&gt; section in the httpd.conf
















Regards
















Gerald




















Von:


Donavon [mailto:donl@mycopanet.com]


Gesendet:
Donnerstag, 9. April 2015 23:10


An:
richter@ecos.de; 'Frank Wesemann'


Cc:
embperl@perl.apache.org


Betreff:
Re: AW: embperl and JSON

















Thank You.



How can this be set for a single embperl .epl file?



I only need to process JSON in one file and leave the fdat processing normal for the hundreds of other files.



Thank You,

~Donavon






On 4/8/2015 3:52 AM,
richter@ecos.de
wrote:









Hi,
















Embperl use CGI.pm only for multipart/formdata.
















encode_json excepts the raw data, while %fdat already has splited them into name/values pairs.
















You need to set

optDisableFormData = 256 in EMBPERL_OPTIONS and read in the posted data on your own
















Regards
















Gerald





























Von:


Donavon [
mailto:donl@mycopanet.com
]


Gesendet:
Donnerstag, 2. April 2015 18:44


An:
Frank Wesemann


Cc:

embperl@perl.apache.org



Betreff:
Re: embperl and JSON

















Hello and Thank You for the reply.



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



Does embperl convert &quot;Content-Type: application/json&quot; to &quot;multipart/form-data&quot;?



or



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 &quot;multipart/form-data&quot; it should be a different issue.
Am I missing something?



Thank You,

~Donavon
















On 4/2/2015 4:44 AM, Frank Wesemann wrote:









This is more a problem of CGI.pm ( which Embperl uses under the hood ).







http://stackoverflow.com/questions/19610312/perl-cgi-passing-variable-in-post-with-json









may help you.


















2015-03-30 18:58 GMT+02:00 Donavon &lt;
donl@mycopanet.com
&gt;:






Hello.



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 &quot;application/json&quot;



It works when I send data via javascript with:


request.setRequestHeader(&quot;Content-Type&quot;, &quot;application/x-www-form-urlencoded&quot;);


request.send(encodeURLQueryString(data));



It doesn't work when I send data via javascript with:


request.setRequestHeader(&quot;Content-Type&quot;, &quot;application/json&quot;);


request.send(JSON.stringify(data));





My submit form looks like this:



submit.epl

[.-

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



$fdat{test}
= &quot;test&quot;;

$json



= encode_json(\%fdat);



$escmode = 0;

$http_headers_out{'Content-Type'}




= &quot;application/json; charset=utf-8&quot;;

print OUT $json;

-]





Thank You,

~Donavon



---------------------------------------------------------------------

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

















!DSPAM:416,551d72ba23601775725073!












!DSPAM:416,5526eaad23271373043029!