http://qs321.pair.com?node_id=11148784


in reply to CGI::Tiny versus undefined parameter/form field

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.

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.

  • Comment on Re: CGI::Tiny versus undefined parameter/form field

Replies are listed 'Best First'.
Re^2: CGI::Tiny versus undefined parameter/form field
by Polyglot (Chaplain) on Dec 12, 2022 at 15:29 UTC
    Yes, I think you are correct: CGI::Tiny is fundamentally different. It won't work for me. Believe it or not, I have used (or tried to) CGI::Simple before. It won't work on my Mac, which is where I develop. So "Simple" didn't live up to its name for me.

    I don't use CGI for much, actually. I use it for the form inputs, and that's about it. So if that is not the portion of its codebase that landed it on the "deprecated" list, I guess I should be fine. In any case, for now at least, I've given up on the CGI::Tiny. It's a tool for someone else. I'm back to good old CGI. One thing that irritated me with CGI is that it only recognizes the "name" attribute of an element, and not its "id". But I guess I can live with assigning both, one for the JS, and one for the CGI. It just seems a shame to have to repeat so many names--fattens the code, and uses more bandwidth.

    Blessings,

    ~Polyglot~

      It won't work on my Mac, which is where I develop. So "Simple" didn't live up to its name for me.

      I find that hard to believe, given the green Darwin column in cpantesters report, unless the test suite is not sufficient. But since I don't have a Mac (and haven't used one since they looked like this), I won't be any help in that regard.

        Well, I have an older Mac, and too much on it to dare trying to upgrade. My Perl version is 5.12--and from the chart you linked, CGI::Simple is compatible with 5.16 at the earliest. I guess that's the deal right there.

        Blessings,

        ~Polyglot~