Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

restful web service server

by westy032001 (Novice)
on May 12, 2011 at 10:22 UTC ( [id://904343] : perlquestion . print w/replies, xml ) Need Help??

westy032001 has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks
I want to create a restful webservice as an interface for simply managing and querying an openldap server,this is partly just a learning exercise for my self.
The only requirement i can think of is it must support ssl for pasword security.
What would you recommend for a lightweight reasonably fast server side ? Any guidance/thoughts gratefully received .

Replies are listed 'Best First'.
Re: restful web service server
by Anonymous Monk on May 12, 2011 at 10:29 UTC
    Pick one and run with it :) if target PSGI/Plack, you can switch servers at any time with no code changes
Re: restful web service server
by sundialsvc4 (Abbot) on May 12, 2011 at 12:10 UTC

    There are really two aspects to that question, which can and should be dealt with separately:

    1. There are many web-servers out there (including tiny Perl programs...), and many ways to deploy apps on those servers (FastCGI, mod_perl, etc.)   It is highly desirable to be able to switch horses in mid-stream; hence the benefits of software-interface layers such as Plack.   (“Design your app for Plack, and you can reconfigure Plack without having highly-pervasive changes in your application.”)
    2. Within the application itself, there is usually “a whole lot of treasure-chest and only a little treasure.”   The chest is basically the same no matter what goes inside, so obtain a suitable chest “off the shelf.”   Hence application frameworks, such as Catalyst (and dozens of others).   Always try to avoid doing something that has already been done.   You want to be able to confine your interests strictly to what is actually different about your application.

    This approach has a subtle added benefit:   it introduces a disciplined, and somewhat distant, perspective upon your own work.

Re: restful web service server
by John M. Dlugosz (Monsignor) on May 12, 2011 at 10:41 UTC
    Check out Catalyst. There are tutorials that include REST.

    As the other reply indicates, the server that hosts it doesn't matter since the framework is abstracted from it.

      thanks for the responses both
      I had wondered if using a framework was the best way to go or if people tended to roll there own.
      I had a look at dancer, i will look at catalyst as well cheers.
      Is there a way of running the perl resources in an existing perl environment rather than a perl env being created, the code run then thrown away which is how i understand cgi works.
        I find Catalyst to be more "glue logic" and "abstraction layer" and gives me all the benefit of rolling my own: I choose what to use! It just provides a nice way to tie everything together, and a cool testing environment.

        Dancer is more "use what they provided".

        I think you are asking about not running the script every time a request comes in, but leaving it running and handling requests. For sure; modperl is the granddaddy of that. "fastcgi" is the current approach. All that is explained in Catalyst tutorials.