Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Detecting modules in use?

by lhoward (Vicar)
on May 29, 2000 at 07:46 UTC ( [id://15243]=note: print w/replies, xml ) Need Help??


in reply to Detecting modules in use?

If you're running Apache there is another way to solve your problem (that has lots of other nice benefits). With mod_perl you can run your unmodified perl CGI scripts under Apache::Registry. In the mod_perl config you can pre-load modules that will be available to all your programs w/o each program needing to explicitly use the module. Also your scripts be compiled once and will run within Apache (no expense of forking another process, so they'll run faster) and with Apache::DBI (no code changes necessary to get this benefit once your're running under mod_perl) you will have a persistant cache of DB handles so establishing DB connections will be much faster.

Replies are listed 'Best First'.
RE: Re: Detecting modules in use?
by BBQ (Curate) on May 29, 2000 at 07:56 UTC
    Sounds awesome! (downloading it as I write this)

    But what kind of an effect would this have on apps that load DBI multiple times? Would they all just be "skipped"? Ie:
    eval { use DBI; require 'intranet.pl'; };
    and having the code mentioned in my first post inside intranet.pl... I would have two or more 'use DBI' calls consecutively. What kind of penalty (if any) would I suffer from coding this way?
      If you're perl CGI already has a "use Foo;" in it there is no penalty (or even a noticeable effect) from having the module pre-loaded in the mod_perl config.

      With a cache of DB handles provided by Apache::DBI you would still probably notice a big performance increase even if your authentication sunroutine has its own DBI connect/disconnect calls. I've several times had to write program that had multiple DBI connections open and never had a problem with any adverse effects from it.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://15243]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-28 20:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found