in reply to In CGI::Application cgiapp_prerun vs. cgiapp_init?

As Belgarion said, the difference doesn't matter when dealing with a standard CGI request cycle. It only matters when dealing with a persistent environment.

The theoretical difference is that cgiapp_init() and setup() should do things like set up your configuration vs. cgiapp_prerun() which should handle things like logging the request and setting up your per-request items. And, the same difference applies to cgiapp_postrun() (per-request) and teardown() (per-application).


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?
  • Comment on Re: In CGI::Application cgiapp_prerun vs. cgiapp_init?

Replies are listed 'Best First'.
Re^2: In CGI::Application cgiapp_prerun vs. cgiapp_init?
by bradcathey (Prior) on Dec 12, 2005 at 18:28 UTC

    Thanks dragonchild, that helps. I assume by "persistent" you mean something like mod_perl? I'm running the regular old CGI cycle, so may I can just dispense with the cgiapp_prerun.

    Well, on to C::A and cookies...


    —Brad
    "The important work of moving the world forward does not wait to be done by perfect men." George Eliot
      I can just dispense with the cgiapp_prerun.

      Don't. You will still benefit mentally from the separation of app-setup vs. response-setup. Plus, if you keep them separate, your migration to mod_perl will be easier when (not if!) it happens.


      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?

        Gotcha. Then, would you mind looking at my code and telling me then if I am using the two (prerun and init) properly. Thanks much


        —Brad
        "The important work of moving the world forward does not wait to be done by perfect men." George Eliot