I don't want to get tangled in the politics of whether CGI is safe to use or is advisable to use or is advisable to start a project with, but my impression from at least here Review of CGI::Alternatives and here UP-TO-DATE Comparison of CGI Alternatives is that there is still a lot of dust in the air and the most important criterion which is safety ticks OK.

Personally, I like my perl scripts to be as simple as possible, look like perl code and smell like perl code (ok i have to admit C influences). If I want to use a template I find the best module for my purpose and use it. I do not use CGI because of its html-producing capabilities neither I do not use CGI because it has no template processing capabilities.

Against CGI is this from https://mojolicious.org/perldoc/Mojolicious/Guides/Cookbook#Apache-mod_proxy:

Apache/CGI

CGI is supported out of the box and your Mojolicious application will automatically detect that it is executed as a CGI script. Its use in production environments is discouraged though, because as a result of how CGI works, it is very slow and many web servers are making it exceptionally hard to configure properly. Additionally, many real-time web features, such as WebSockets, are not available.

I find this kind of arguments much more convincing than "even the people who maintain CGI recommend against it". If they do then they should delegate maintenance to someone else or shut the project down if it is indeed some expired and menace-to-the-unsuspected-public technology.

So, with my amateur-web-design background and the 30% knowledge of Perl that I have, I will still provide examples using CGI without claiming that this is the best or the only way to do it. I will make a mental note from now on to mention the weird fact that the maintainers of CGI dicourage its use and promote something else instead without strong arguments (as one would expect in this case) such as safety, performance+efficiency, code re-use, code maintanability. And I will also mention that with maintainers like them, CGI will very soon become obsolete (maybe already is wrt websockets) and die from an act of patroctony.


In reply to Re^7: searching for small Cookies example but found does not work by bliako
in thread searching for small Cookies example but found does not work by toohoo

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.