> > > > Well, it should be documented "somewhere in the guide", or
> > > > presumable in
> > > > Apache::DBI.pod, that one should *only*
> > > >
> > > > PerlModule Apache::DBI
> > > >
> > > > Since it's pointless in startup.pl (right?).
> > >
> > > I think you need to think that one through a bit more :)
> >
> > I disagree.  I *did* think it through.
> >
> > When involving Apache::DBI, one of two situations is true:
> > either you are
> > starting the webserver, or you are changing/testing startup.pl.
> >
> > When starting the webserver, Apache::DBI loads and **transparently**
> > replaces the function of DBI->connect.  If one were to NOT load
> > Apache::DBI, everything would work JUST THE SAME (codewise), but we
> > don't see the benefits that Apache::DBI provide.
>
> true
>
> >
> > When messing with startup.pl, Apache::DBI is redundant.  Since it's
> > transparent, and only works when RUNNING the httpd,
>
> nope - see below
>
> > it is "undesired" to have it in startup.pl, since it will only
> > cause errors.
>
> I disagree with that - I do it all the time.
>
> >
> > HOWEVER,
> > loading Apache::DBI as
> >
> > httpd.conf:
> > PerlModule Apache::DBI
> >
> > means that it only loads when it's worth loading, i.e. server
> > startup.  If startup.pl then logically contains init code wrapped
> > in a test for whether it's running under mod_perl, within that
> > block becomes a good place for Apache::DBI specific
> > initialization.
> >
> > So... your response indicates you think I missed something so
> > obvious that I would pick it up on a re-think.  Well, this is my
> > original-think... have I really missed something?
>
> ok, at least you're thinking :)
>
> the two things I had in mind were:
>
> a) generally, you ought to pre-load all your modules in startup.pl
> so that you get the maximum amount of code-sharing/memory-sharing,
> etc.
>
> b) you couldn't call
>
> Apache::DBI->connect_on_init;
> without first
> use Apache::DBI;

Except that (and I have to check this to be ABSOLUTELY shure but) PerlModule
Apache::DBI happens first, THEN startup.pl.

I just checked, and it works exactly that way when the httpd.conf directives
are in the following order:

PerlModule      Apache::DBI
PerlRequire     /etc/httpd/perl/lib/startup.pl

Since Apache::DBI is now loaded into the (single) perl interpreter's symbol
table, and since the above call to connect_on_init() is a method call (vs an
exported symbol), calling methods on it are valid, and can be easily wrapped
as I suggested in an "if($ENV{MOD_PERL}) {}" block.  Explicitly, it is *NOT*
required to 'use Apache::DBI ();' in startup.pl to do this.

> your *only* up top I thought was a bit strong, which was why I was trying
to
> encourage deeper thought...  for the most part, though, you "get"
> Apache::DBI, which is more than be said for most...
>
> I hope you found it constructive criticism and not condescending
> - you seem like a person who wants to understand :)

Absolutely... I'm on this list to edify and to be edified.

L8r,
Rob

#!/usr/bin/perl -w
use Disclaimer qw/:standard/;

Reply via email to