Skip to content

Web::Simple

Official Website: CPAN

mst’s Introduction Blog Post: http://www.shadowcat.co.uk/blog/matt-s-trout/introducing-web-simple/

Blurb:

A quick and easy way to build simple web applications

Longer Blurb:

The philosophy of Web::Simple is to keep to an absolute bare minimum, for everything. It is not designed to be used for large scale applications; the Catalyst web framework already works very nicely for that and is a far more mature, well supported piece of software.
However, if you have an application that only does a couple of things, and want to not have to think about complexities of deployment, then Web::Simple might be just the thing for you.

How:

Follow the local::lib instructions first.

Then install via:

cpanm Web::Simple

Hello World / app.psgi

We’re going to embed our entire app in our app.psgi file (Web::Simple supports PSGI/Plack so as always, our goal here is to produce an app.psgi file to use when running our app).

# app.psgi
use Web::Simple 'HelloWorld';
{
  package HelloWorld;

  dispatch {
    sub (GET) {
      [ 200, [ 'Content-type', 'text/plain' ], [ 'Hello Web::Simple!' ] ]
    },
    sub () {
      [ 405, [ 'Content-type', 'text/plain' ], [ 'Method not allowed' ] ]
    }
  };
}
HelloWorld->run_if_script;

Run it!
Now that your app.psgi file has been created, you can choose any of the deployment options listed on the Plack page.

Live Demos:

http://hostmonster.perlsharedhosting.com/web-simple

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS