Loading ...
Sorry, an error occurred while loading the content.

640RE: [ANNOUNCE] Apache::ASP Style Guide, first release

Expand Messages
  • ellers@iinet.net.au
    Aug 28, 2002
    • 0 Attachment
      > > > I thought mentioning the OnStart handler for db connection was
      > > great. Perhaps add a $dbh = undef or whatever in the OnEnd handler
      > > to disconnect? (I know you have the cleanup rollback there... but is
      > > that different?)
      > > >
      > > Thanks. Its a good point for memory freeing. I just added
      > > it to the example.
      > This begs a big question that was answered somewhat indirectly:
      > Where do you create the database connection?

      I just always do it in Script_OnStart. The site I used this with is fine like this ... although having said that it doesn't make huge demands on the DB.

      > Due to the persistant nature of mod_perl (about which I am just learning),
      > It is important to get that right. Is this every time the page hits, or that
      > the page is compiled, ie the first time this particular apache process runs
      > this script?

      If in the Script_OnStart it is every time the page is returned back to the requester. Similarly with the Script_OnEnd for cleaning up the connection. With MySQL (can't speak for other DBs) the connection seems to be quite light-weight...

      > Another stle question: I have an app that use a lot of variables like $bgcolor
      > and such so I can change just one spot, and it changes all over the
      > application. $Application->{bgcolor} seems like a logical place to put it.
      > I assumed then, that Application_OnStart was the place to put definitions like
      > these; unfortunately, it didn't seem to work, even when I killed apache
      > altogether and restarted.
      > What should I do?

      Josh or another list member probably has the "right" answer... but my simple solution to constants is to them in either the Script_OnStart section (prob not necessary in the case of constants) or just in the global.asa file, anywhere.


      To unsubscribe, e-mail: asp-unsubscribe@...
      For additional commands, e-mail: asp-help@...
    • Show all 6 messages in this topic