Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: Unloading a perl module

by Arguile (Hermit)
on Nov 14, 2001 at 15:24 UTC ( #125293=note: print w/replies, xml ) Need Help??

in reply to Unloading a perl module

Better to declare them in httpd.conf or a type script.
# httpd.conf PerlModule Date::Manip # or use Date::Manip ();

This allows them to be cached on server boot and shared between child processes. The () after the module in is very important as it means the module won't polute your global namespace (exports nothing).

This gives you the performance advantage of having the module already compiled and cached, while keeping your memory requirements (per child) down. Make sure to still use the module in your hanlder/script though; while not always nesseccary it gets pretty confusing if you don't.

If you're running Apache::Registry or PerlRun the rules are slightly different. Check the guide for more info.

Replies are listed 'Best First'.
Re: Re: Unloading a perl module
by mce (Curate) on Nov 14, 2001 at 15:34 UTC
    After a quick supersearch, I came up with this node
    Dr. Mark Ceulemans
    Senior Consultant
    IT Masters, Belgium
Re: Re: Unloading a perl module
by ehdonhon (Curate) on Nov 14, 2001 at 17:38 UTC

    I've tested this in the past. I found that even if you don't have a and just let your cgi scripts use the modules, they still get loaded into global namespace to be shared by all the children. I didn't do a lot of testing in this area, so your results may vary. If they do, I'd love to hear more about it.

      The manual states (IIRC) that modules are shared until you modify internal variables, and then they become specific to the process that modified the variable. So as long as you don't keep state in the modules (few do) you will be getting the most efficient treatment.

      I didn't believe in evil until I dated it.

      This is only true if your CGI scripts get loaded during startup, i.e. any modules you load and any modules they load during server startup will be shared via copy-on-write.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://125293]
[robby_dobby]: page for yapceu is out of date by 2 years
[robby_dobby]: LanX: Sharm-el-Sheikh is in Egypt
[robby_dobby]: Thanks, choroba
[LanX]: yes and Egypt (like Turkey and Russia) belongs to two continents
[choroba]: Also Europe and Asia are geographically one continent, the division is political
[robby_dobby]: I always thought everything on the other side of Suez to be Africa. That's an entire continent
[LanX]: Sinai_Peninsula
[robby_dobby]: choroba: If you're talking of Eurasia, it's only true of the erstwhile Constantinople/ Ottoman empire
[LanX]: yes correct, but Sinai is not on the other side

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (15)
As of 2017-04-24 16:05 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (442 votes). Check out past polls.