Re: loading Perl modules in mid program

by David Mintz <mambomintz(at)yahoo.com>

 Date:  Mon, 12 Jun 2000 08:30:50 -0700 (PDT)
 To:  hwg-languages(at)hwg.org
  todo: View Thread, Original

--- Rich Bowen <rbowen(at)rcbowen.com> wrote:
> David Mintz wrote:
> > 
> > 
> > Is there a way to bring in a module only when you
> need
> > it rather than loading it at the top of the
> program?
> 
> Yes, there is <snip>
 
Thanks. Actually, I had a hunch you could say
'require' because I noticed Randall Schwartz himself
doing that in one of his WebTechnques columns, but I'd
thought I'd throw it out there anyway, in the hopes of
picking Bowen's brain -- and I wasn't disappointed.
You schooled me to the subtleties that I otherwise
wouldn't have known. I'm not 100% sure I follow the
bit about exporting symbols -- good topic for Perl Two
at HWG Online, perhaps? -- but I definitely get the
idea, and I guess the bottom line is, try it.

If it doesn't really make all that much performance
difference then I won't worry about it. I just feel
like kind of a pig because I'm _use_ing half the CPAN
archive -- OK, I exaggerate. I'm using Carp, CGI,
EMail::Valid, Mail::SendMail, and DBI in this one
program.

You mention benchmarks -- Wanna point me to wherever I
can learn more about measuring my scripts'
performance? I'm slightly performance-obsessed because
the server where I'm a tenant sometimes is slower than
hell and I want to be sure the bottleneck isn't me.

Shaun raises another good point about when it's wise
to break it up into several smaller programs instead
of one big one. I've thought about that. Partly I want
to be macho and meet the challenge of keeping track of
all these screens and where we're going and where
we've been, but mostly it's Laziness:  I'd rather work
on one program than several.

David Mintz
Web Design & Hosting http://www.dmintzweb.com
Personal http://www.panix.com/~dmintz

__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com

HWG: hwg-languages mailing list archives, maintained by Webmasters @ IWA