perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Donavon <d...@mycopanet.com>
Subject Re: Question concerning REST
Date Fri, 17 Jun 2016 16:21:12 GMT
Hello.

We would like to create an API using REST and EMBPERL.

Did you come up with a working solution to implement REST with embperl?

Thank You,

~Donavon


On 8/27/2015 6:40 AM, Jean-Christophe Boggio wrote:
> Le 24/08/2015 19:57, Jim Howard a écrit :
>> Darn.  My only other bit of advice was "Are you sure Embperl is best for
>> this?"
>
> No, I'm not sure it's "the best". But I'm sure it's possible (see below).
>
>> My company maintains a large Embperl app, but we use other tools for
>> REST/JSON (one of the reasons we are moving away from Embperl).
>
> My application is rather large and I only needed to create a small 
> webservice so switching to another language just to write 20 lines of 
> code was bugging me.
>
>
> Okay, so solution that works for me :
>
> 1. a) You must disable Embperl's form data processing by using 
> optDisableFormData. I did this in :
>
> <Location /rest>
>     EMBPERL_OPTIONS        256
> </Location>
>
> 1. b) For some mysterious reason, doing this (and it does the same if 
> I rather use a <Directory> directive), the EMBPERL_OBJECT_BASE that I 
> set for the whole virtualhost to "base.epl" is lost and I *MUST* use 
> "_base.epl". Forcing it in the <Location>/<Directory> does not work. 
> So I did a symbolic link :
>
> ln -s base.epl _base.epl
>
> 2. Then, in order to read the POSTDATA, the only way I found was to 
> dig in Apache2::Request. Here is my code. It works. At least for the 
> very small use I have.
>
> First install the module :
>
> sudo apt-get install libapache2-request-perl
>
> [-
> use Apache2::Request;
> use Apache2::RequestIO;
>
> my $buffer;
> $req_rec->read($buffer,9999);
> warn "buffer::$buffer";
> -]
>
> I call it like this :
>
> curl -i -X POST -d '{"name":"toto"}' 
> http://omico.miaou/rest/notifent.html
>
> And the logs say :
>
> [Thu Aug 27 15:32:48 2015] [warn] [19141]ERR:  32:  Warning in Perl 
> code: buffer::{"name":"toto"} at /.../omico/rest/notifent.html line 10.
>
>
> Oh, and by the way, GET, PUT and DELETE also work.
>
> Hope this helps.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>


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


Mime
View raw message