Hi again,

> > Pass a reference.
> > my $rhash = \%output;
> > my $result = func( $rhash );
> 
> Okay this solves my problem that I had.
> Is it in anyway possible to tie the hash once to a dbm file?
> At the moment it is tied every time a script is called. 

Sounds like you haven't really got to grips with handlers, and your
script is written in a cgi-like fashion.  You want mod_perl to load
the script once at startup, then just execute the things that need
executing when a handler is called.  Read the Guide.  I'm sorry it's
such a forbidding document thesedays, but it's really worth it.  Read
the Eagle Book too.  Then read it all again (unless your ability to
absorb densely packed information is absolutely astounding:).

> Does the line $test = dbmopen(%output, "/my.dbm", 0600) ; on 
> every script cause much work?

It depends what you mean by 'not much'.  Opening and closing files is
one of the life-blood activities of the operating system, so lots of
work has gone into making it as slick as possible.  But it still takes
more time than referring to areas of data directly in memory because
there's more to do and because the physics of storage is different.
What matters is how often your script gets called, and whether the
computer can keep ahead of its tasks under maximum load.  Someone who
serves, say, a hundred training courses to 400,000 users may go to
great lengths to cut execution times, but it might be that it doesn't
matter in your case.  Or you might get a kick out of tuning systems.
Only you can be the judge of that.

There are utilities out there to test performance, after a fashion.
Look at ab which comes with Apache when you install it.  But don't
forget that when Apache is serving pages, mod_perl or not, it's not
just your script that's doing the work.  It's a very complex system
that you're dealing with, which probably includes a worldwide network,
a bunch of communications devices and a browser, running on hardware
you've never seen and never will.

See also the thread "how to really bang on a script" in this list
which has some more references and some entertaining insights.  The
ISBN for the Eagle Book is in one of my posts on that thread.

73,
Ged.


Reply via email to