leocharre has asked for the wisdom of the Perl Monks concerning the following question:

Anybody here used CGI::Application before? I have some apps I'd consider turning into it.- It's looking interesting. Maybe this would make an application more accessible to other coders? To use this set of modules?

  • Comment on Anyone have experience with CGI::Application ?

Replies are listed 'Best First'.
Re: Anyone have experience with CGI::Application ?
by Asim (Hermit) on May 31, 2006 at 15:37 UTC
    Maybe this would make an application more accessible to other coders?

    Maybe. It's on the likely side. I like CGI::Application for the couple of uses I've put it to, so far -- it's better-supported than my primary choice, Catalyst, on win32 platforms, for one thing.

    However, what's more important is that your code is nicely formatted, commented, and documented. A platform can help with these issues, yet it's only a help, not a solution. If you like what it does for helping you code, and think you can create better applications with it, go for it.

    More than that is hard to say, or to simply help you with, without more information, from you, on what applications you're coding, your environment (things like space and module install abilities make a huge difference in these questions), and the like. Does that make sense? :)

    ----Asim, known to some as Woodrow.

      Yes.. Well.. Obviously this is a web app, and has many "states" - or .. "runmodes".

      I had all of them coded into one cgi at one point, but found it much neater to organize into sepparate cgis, they are all tiny scripts, as the bulk of it lies in modules.

      But now I have like 40 cgis and it's looking mediocre.. ? So.. I considered consolidating some of them, then.. I wonder if I should use CGI::Application- It seems maybe- I could offer parts of this as addons... to CGI::Application? It seems someone made an image gallery.. etc..

      I have a web app that lets computer illiterates manage files, directories, users, and access to all three.

        There's nothing inherently wrong with having 40 cgis and CGI::Application supports that. Sure, the cgi is quite simplistic:

        use strict; use My::CGI::Application::App; my $app = My::CGI::Application::App->new(); $app->start_mode( 'run_mode_that_matches_cgi_name' ); $app->run();
        That way you can have distinct namespaces for the modes of your app --- think /cgi-bin/search, /cgi-bin/results, /cgi-bin/display ... that's a bit better (IMHO) than /cgi-bin/app?mode=search, /cgi-bin/app?mode=results, /cgi-bin/app?mode=display. Sure under the covers it's all the same thing but having that clean namespace can be a blessing when you wish to have some special handler for a particular runmode (the handler can then sit on top of the namespace ala modperl instead of being integrated into the app).

        -derby
        they are all tiny scripts, as the bulk of it lies in modules.

        Coolness! For something like that, yes, CGI::Application makes a great deal of sense. Since you've already done most of the refactoring work, you should have a win with using runmodes over a hand-rolled calling solution, in the long run.

        Plus, it makes it easier to pass auth or other data, which can help tie your application together. That's a win, and I think your instincts are dead on.

        ----Asim, known to some as Woodrow.

Re: Anyone have experience with CGI::Application ?
by dragonchild (Archbishop) on May 31, 2006 at 15:54 UTC
    Re: CGI::Application - why?

    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?