You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by VML <vi...@fastmail.fm> on 2002/04/18 12:22:12 UTC

Loading function?

Hi All,
We have script that including functions in different file.
Can I pre-loading the functions?
Where I put it? into startup.pl?
How I pre-loading it?

Here is my startup.pl

#/usr/bin/perl
use strict;

# only library-type routines should go in this directory

use lib "/var/www/perllib";

# Why below not working???
# make sure we are in a sane environment.
# ENV{GATEWAY_INTERFACE} =~ /^CGI-Perl/ or die "GATEWAY_INTERFACE not Perl!";


use Apache::Registry(); # for things in the "/programs" URL

# Why below not working???
#use Apache::RegistryLoader();
#Apache::RegistryLoader->new->handler("/perl/timeres.pl","/var/www/cgi-bin/timeres.pl");

use CGI (); CGI->compile(':all');
use DBI ();
use DBD::mysql ();

1;

---

Here is my script:

#!/bin/perl
require "cgi_lib.pl";
require "library.pl";

Both are function files.



Thank you,

Ricky

Re: Loading function?

Posted by Stas Bekman <st...@stason.org>.
VML wrote:
> Hi All,
> We have script that including functions in different file.
> Can I pre-loading the functions?
> Where I put it? into startup.pl?
> How I pre-loading it?

Read these two:
http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/porting.html#Reloading_Modules_and_Required_Files
http://perl.apache.org/preview/modperl-docs/dst_html/docs/1.0/guide/performance.html#Preloading_Perl_Modules_at_Server_Startup
and the following section


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com