When developing a web application, early on, when I was a vanilla CGI programmer, I often had a certain webpage whose contents would vary based on what "mode" the page was in.

For example, for a CGI GUI to a database search, the first mode of the page would present a bunch of pulldowns to customize SQL generation. Then, on re-submission of the page, the pulldowns would turn into uneditable text, showing the results, and a table of search results might be shown.

Jesse Erlbaum calls these run-modes and he discusses them in his recent Perl.com article in the context of his flexible web application development environment which is completely webserver, database, and architeceture agnostic. That is to say, things run just as well on the popular Linux/MySQL/Apache combo as NT/Access/IIS... which is really saying something given the general preferences of the Perl community.

I suggested object-oriented multiple dispatch in a recent perlmonks.org thread and in this article Erlbaum provides info on how CGI::Application handles this same problem.

I think the question I would ask him is why he thinks that run modes should be easily and uniquely dispatched based on a single parameter, because I once had a certain webpage whose contents was a function of HTTP_REFERER and the value of the submit button. The page whose output was a function of the multiple parameters listed above was a gem display page... In some cases, you were inputting values into this page. In other cases, you were editing values on this page. In other cases, you were checkign the status of this gem. In other cases, you were confirming input values on the page.

In fact from a purely theoretical viewpoint, it is well-known that single-inheritance is not always enough to partition the space of object-oriented computation into separate methods of computation.

Other Things about CGI::Application

  • Templating EngineErlbaum makes it clear why HTML::Template is his templating module of choice. For more information on templating in general, visit this Perlmonks.org node
  • Sessioning, Security unlike HTML::Embperl, CGI::Application does not try to be your all-in-one one-stop-shop for all aspects of Web Application Development. However, he does state that related CPAN modules will fit in orthogonally with no problem.

    In reply to Dynamic Webpage Dispatch with CGI::Application(keywd: Web Software Engr) by princepawn

    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.