On Thu, 21 Jun 2001, Stas Bekman wrote:
> On Wed, 20 Jun 2001, Mark Doyle wrote:
>
> > Greetings,
> >
> > require will only happen once per perl process and since mod_perl
> > is essentially a single perl process, the file is only require'd
> > for the first request. You can get around this by deleting the file from
> > the %INC
> > hash which keeps track of which files you have loaded. Something like:
> >
> > BEGIN {
> > delete $INC{'/foo/bar/query.pl'} if exists $INC{'/foo/bar/query.pl'};
> > require '/foo/bar/query.pl';
> > }
>
> Mark, your suggestion doesn't work because of BEGIN.
Ooops, gotta go to sleep. Your suggestion, Mark, will work :) but only in
Registry/PerlRun which executes BEGIN on every request.
Sorry about my previous post :(
But if you delete and reload the file on every request it defeats the
purpose of using mod_perl to some degree, depending on how many files you
force to reload and how big they are.
BTW, here is shorter version of your suggestion:
BEGIN { do '/foo/bar/query.pl'; }
> See the URL posted in my other reply for the explanation.
Still holds :)
> > Cheers,
> > Mark
> >
> > On Wednesday, June 20, 2001, at 10:04 AM, Purcell, Scott wrote:
> >
> > > Hello,
> > > I have a question about require when using mod-perl. I produced four
> > > simple
> > > .pl files.
> > > main.pl, one.pl two.pl three.pl
> > >
> > > So my question is why this bazaar behavior. If I change the query.pl
> > > to a
> > > module and use it in each of the pages it is fine. I just find this
> > > behavior
> > > rather funny. If anyone has any insight please update me.
> > >
> > > Thanks,
> > > Scott Purcell
> > >
> >
>
>
>
> _____________________________________________________________________
> Stas Bekman JAm_pH -- Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide http://perl.apache.org/guide
> mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
>
>
>
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/