Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Why CGI::Application?

by DrHyde (Prior)
on Jan 13, 2004 at 13:24 UTC ( [id://320947]=note: print w/replies, xml ) Need Help??


in reply to Why CGI::Application?

I tried to use it recently for a big app at work. All the *real* work is packaged up in modules, but for the webby front-end I thought CGI::Application would help. It didn't. All it did was irritate me, so before I got too far, I threw it away, and turned my code into one really big if ... elsif ... elsif ... else. It works. It makes sense.

And it's only big because each block consists of stitching together a big data structure by calling a load of object methods (and these are BIG structures, for complex pages) which is then passed to TT. There's not all that many statements in there.

Replies are listed 'Best First'.
Re: Re: Why CGI::Application?
by derby (Abbot) on Jan 13, 2004 at 13:41 UTC
    All it did was irritate me

    How? Did it make your eyes water? Your scalp itch? A burning sensation in an area not discussed amongst mixed company?

    Look, I'm not much into promoting or even believing in any silver bullet theories but I must say CGI::Application has been a boon to my development. As another poster stated, it started me thinking about my webapps as state machines and that has been a good thing. Maybe your apps don't need that, if you have a simple CGI that does one thing only - then probably not. But once you get into a multi-step, multi-form, webapp, CGI::Application is definetly a plus.

    If you have the time or inclination, please write up what irritated you. Give us examples of how your approach is better ... are you sure it wasn't the small learing curve for CGI::Application that just got in the way of you delivering the product.

    -derby

      As another poster stated, it started me thinking about my webapps as state machines and that has been a good thing.

      It most certainly is a good thing!

      Maybe your apps don't need that, if you have a simple CGI that does one thing only - then probably not. But once you get into a multi-step, multi-form, webapp, CGI::Application is definetly a plus.

      CGI::Application makes it no easier to write multi-form applications as far as I can tell. All my form submissions have an action=foo parameter. The various foos have sensible names and simply make the big if ... elsif ... else block call the appropriately named subroutine. This is exactly the same as CGI::Application's "run modes"

      If you have the time or inclination, please write up what irritated you.

      It irritates me because it provides nothing useful, while wrapping itself up in grandiose language about how it will make the web application world a better place.

      Give us examples of how your approach is better ...

      I can't give you the code, but I consider it to be better because it has fewer dependencies while requiring me to do just as much work, and because it's one less thing for someone else to have to learn before maintaining my code.

      are you sure it wasn't the small learing curve for CGI::Application that just got in the way of you delivering the product.

      What learning curve? CGI::Application is far simpler than some of the other modules I'm using.

      I should write this up as a review for cpanratings.

        I can't give you the code, but I consider it to be better because it has fewer dependencies while requiring me to do just as much work, and because it's one less thing for someone else to have to learn before maintaining my code.

        Your logic is horribly flawed. You just _added_ to the code that your maintainance crew will have to work with. Not only that but your code almost certainly doesnt work the way the other project coded in your firm that used similar rationale. Now they have to know how two different rolled-yer-own systems handle things.

        If you had stuck to CGI::Application, your maintainence crew would have the support of thousands of programmers with considerable experience in using it, they would have recourse to an external party with considerable skill (and from my experience a desire to help) to resolve ongoing issues in the code. Simply upgrading to the latest release would probably resolve all the maintainence issues associated with the handler. Not to mention other issues like security patches etc.

        Just to rub the point in, did you roll your own CGI as well?

        PS: I am not a knee jerk, use the modules kind of guy. But if you are going to reinvent a well established, tried and tested wheel, it had better be superior to the wheel you rejected. And frankly given your response Im doubtful.


        ---
        demerphq

          First they ignore you, then they laugh at you, then they fight you, then you win.
          -- Gandhi


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://320947]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-29 14:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found