Here's your simple example implemented using Mojolicious:

#!perl use Mojolicious::Lite; any '/route_name' => sub { my ( $self ) = @_; $self->render( json => whatever( $self->req->json ) ); }; sub whatever { my ( $request ) = @_; ... } app->start;

Benefits out of the box: strict and warnings enabled by default, doesn't need a third party webserver in front of it, is persistent (will be 100+ times faster than your CGI script - oh "mod_perl" you say? I thought we were all done?), is utf-8 safe, is cleaner, is easier to test, is none blocking, etc, etc, etc.

Saying CGI.pm is simple and that by just writing the code you're all done is to forget the amount of faff required in actually running a cgi script, and then even more faff if you want to do anything slightly more complex and scalable with it.

FWIW CGI.pm is not dead, but i am not accepting any more feature requests for the module, and will not be doing any maintenance except critical bug fixes. Essentially it is "done".


In reply to Re: Is CGI.pm dead? by leej
in thread Is CGI.pm dead? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.