Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I've been trying to "upgrade" one of my scripts from the now-outdated (so I am told) CGI.pm to a more modern implementation that I had hoped would be mostly a "drop-in" replacement for it: CGI::Tiny.

What portion of the CGI::Tiny documention said to you "drop-in replacement"? Looking at that documentation, compared to my CGI.pm experience, it seems a completely different philosophy.

Something like CGI::Simple, on the other hand, specifically says as the first sentence of the DESCRIPTION: "CGI::Simple provides a relatively lightweight drop in replacement for CGI.pm." It has all the parameter-handling interface, without any of CGI.pm's poorly-designed and deprecated HTML-generating code.

  • If your goal is a drop-in replacement, I would suggest going with CGI::Simple (or just using the non-HTML portions of CGI.pm -- because while the HTML generation portion is deprecated, and the whole module is now non-core, CGI.pm and the Common Gateway Interface it implements still works and is still available and useable); then you can spend your learning-effort in something like Template Toolkit for improved HTML generation, instead of learning a new philosophy for handling the parameters and everything.

  • If you want to learn something new and different on the interface side, then CGI::Tiny might do it; but looking briefly at its documentation, I would not have come up with a SSCCE like hippo was able to do here, so it might not have the easiest learning curve for someone who still has the CGI.pm thought processes...

  • But if you're going to bother trying to learn a whole new philosophy anyway, why not go with one of the "big 2" rather than CGI::Tiny , which I have rarely-if-ever remembered seeing mentioned here. For me, when I tried to expand my horizons a couple years ago, I was able to learn from the Mojolicious::Lite documentation sufficiently to get apps of similar complexity to the ones I used to do in CGI.pm, so that is what I personally use when doing a new script for my hobby website; I am not an expert by any means, but I can get some simple endpoints. (Something that I don't think is clear enough in their docs: if you have an old-fashioned CGI-based web host, like many of the shared hosts out there, you don't need to do any of their fancy stuff with the "server" side of things; you just put your Mojolicious::Lite-using script in your cgi-bin folder or wherever you used to put it with a CGI.pm-based app, and it will work the same.)

CGI::Alternatives does a really good job of showing you an old style CGI+HTML-from-CGI.pm, then showing you the equivalent application in CGI.pm+TemplateToolkit (which would be virtually identical to CGI::Simple + Template Toolkit if you wanted to go down that path), and then in Mojolicious::Lite, Mojolicious "full", and Dancer2.


In reply to Re: CGI::Tiny versus undefined parameter/form field by pryrt
in thread CGI::Tiny versus undefined parameter/form field by Polyglot

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-16 14:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found