Re: Modules Executed Twice

2002-12-31 Thread darren chamberlain
* Perrin Harkins [EMAIL PROTECTED] [2002-12-30 19:07]:
  Explanations and other suggested approaches to handling this problem
  will be most welcome.
 
 My suggestion in the past has been to PerlRequire a startup.pl that
 does a use on your modules, instead of pulling them in with
 PerlModule.

I believe that if you have custom directives, you need to PerlModule
your module -- a simple 'use Foo;' line within a PerlRequire'd script
is not sufficient.

(darren)

-- 
Do you realize how many holes there could be if people would
just take the time to take the dirt out of them?



Re: Modules Executed Twice

2002-12-30 Thread Stas Bekman
David Wheeler wrote:

Hi All,

I'm developing a new module for mod_perl 1.27, and I'm noticing that  
some code is getting executed twice when the Apache server starts up.

It was supposed to be fixed in 1.25_01:

=item 1.25_01 - July 6, 2001
...
fix double-loading bug of Perl{Require,Module}s at startup time

Here is the diff:

Index: Apache/Apache.pm
===
RCS file: /home/cvs/modperl/Apache/Apache.pm,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- Apache/Apache.pm29 Jan 2001 16:07:08 -  1.62
+++ Apache/Apache.pm26 Apr 2001 05:30:45 -  1.63
@@ -30,7 +30,10 @@

 sub httpd_conf {
 shift;
-push @Apache::ReadConfig::PerlConfig,
+no strict 'refs';
+#use a symbolic reference so %Apache::ReadConfig::
+#is empty at compile time
+push @{Apache::ReadConfig::PerlConfig},
   map $_\n, @_;
 }

[...]

sub test_seen {
return if $Apache::Server::Starting;
$seen++;
warn Seen: $seen\n
}


Indeed, that's the workaround that was added originaly to cure the above 
problem. Perhaps you can play with httpd_conf and see why it doesn't 
work for you. I know that several people have reported that they still 
had this problem since 1.26 was released.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



Re: Modules Executed Twice

2002-12-30 Thread David Wheeler
On Monday, December 30, 2002, at 02:45  PM, Stas Bekman wrote:


David Wheeler wrote:

Hi All,
I'm developing a new module for mod_perl 1.27, and I'm noticing that  
some code is getting executed twice when the Apache server starts up.

It was supposed to be fixed in 1.25_01:

=item 1.25_01 - July 6, 2001
...
fix double-loading bug of Perl{Require,Module}s at startup time


Hrm, interesting. I wonder what the problem is?


Indeed, that's the workaround that was added originaly to cure the 
above problem. Perhaps you can play with httpd_conf and see why it 
doesn't work for you. I know that several people have reported that 
they still had this problem since 1.26 was released.

I have a better workaround, now. I found that I could make the problem 
go away by reversing the order in which the modules are loaded in 
httpd.conf:

PerlModule TestSeen
PerlModule DoubleTest

Not exactly sure why that makes a difference, though.

Is httpd_conf() documented somewhere? I can't see what's supposed to be 
passed to it.

Thanks,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]



Re: Modules Executed Twice

2002-12-30 Thread Stas Bekman
David Wheeler wrote:

On Monday, December 30, 2002, at 02:45  PM, Stas Bekman wrote:


David Wheeler wrote:


Hi All,
I'm developing a new module for mod_perl 1.27, and I'm noticing that  
some code is getting executed twice when the Apache server starts up.


It was supposed to be fixed in 1.25_01:

=item 1.25_01 - July 6, 2001
...
fix double-loading bug of Perl{Require,Module}s at startup time



Hrm, interesting. I wonder what the problem is?


Indeed, that's the workaround that was added originaly to cure the 
above problem. Perhaps you can play with httpd_conf and see why it 
doesn't work for you. I know that several people have reported that 
they still had this problem since 1.26 was released.


I have a better workaround, now. I found that I could make the problem 
go away by reversing the order in which the modules are loaded in 
httpd.conf:

PerlModule TestSeen
PerlModule DoubleTest

Not exactly sure why that makes a difference, though.

Because $seen wasn't reset yet on reload.


Is httpd_conf() documented somewhere? I can't see what's supposed to be 
passed to it.

It's an internal thing. You can add debug prints and Carp::cluck, to see 
who calls it with what args. Hopefully someone will be able to track the 
problem down and finally cure it for good.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com



RE: Modules Executed Twice

2002-12-30 Thread Hann, Brian
Is anyone getting duplicates (i.e. 2 of the same email) of this thread?  It just 
started happening today.

Brian

-Original Message-
From: Stas Bekman [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 30, 2002 5:06 PM
To: David Wheeler
Cc: [EMAIL PROTECTED]
Subject: Re: Modules Executed Twice


David Wheeler wrote:
 On Monday, December 30, 2002, at 02:45  PM, Stas Bekman wrote:
 
 David Wheeler wrote:

 Hi All,
 I'm developing a new module for mod_perl 1.27, and I'm noticing that  
 some code is getting executed twice when the Apache server starts up.


 It was supposed to be fixed in 1.25_01:

 =item 1.25_01 - July 6, 2001
 ...
 fix double-loading bug of Perl{Require,Module}s at startup time
 
 
 Hrm, interesting. I wonder what the problem is?
 
 Indeed, that's the workaround that was added originaly to cure the 
 above problem. Perhaps you can play with httpd_conf and see why it 
 doesn't work for you. I know that several people have reported that 
 they still had this problem since 1.26 was released.
 
 
 I have a better workaround, now. I found that I could make the problem 
 go away by reversing the order in which the modules are loaded in 
 httpd.conf:
 
 PerlModule TestSeen
 PerlModule DoubleTest
 
 Not exactly sure why that makes a difference, though.

Because $seen wasn't reset yet on reload.

 Is httpd_conf() documented somewhere? I can't see what's supposed to be 
 passed to it.

It's an internal thing. You can add debug prints and Carp::cluck, to see 
who calls it with what args. Hopefully someone will be able to track the 
problem down and finally cure it for good.

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Modules Executed Twice

2002-12-30 Thread Stas Bekman
Hann, Brian wrote:

Is anyone getting duplicates (i.e. 2 of the same email) of this thread?  It just started happening today.


I can't tell, since I never receive dups because of the procmail rule:

:0 Wh: msgid.lock
| formail -D 8192 saved/msgid.cache

hint, hint ;)

__
Stas BekmanJAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide --- http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: Modules Executed Twice

2002-12-30 Thread Perrin Harkins
 Explanations and other suggested approaches to handling this problem
 will be most welcome.

My suggestion in the past has been to PerlRequire a startup.pl that does a
use on your modules, instead of pulling them in with PerlModule.
Of course, if you turn PerlFreshRestart on then this is the intended
behavior.
- Perrin





Re: Modules Executed Twice

2002-12-30 Thread David Wheeler
On Monday, December 30, 2002, at 04:09  PM, Perrin Harkins wrote:


My suggestion in the past has been to PerlRequire a startup.pl that 
does a
use on your modules, instead of pulling them in with PerlModule.
Of course, if you turn PerlFreshRestart on then this is the intended
behavior.

That's exactly what I do, too. But I want to give users the flexibility 
to do both.

Thanks,

David

--
David Wheeler AIM: dwTheory
[EMAIL PROTECTED] ICQ: 15726394
http://david.wheeler.net/  Yahoo!: dew7e
   Jabber: [EMAIL PROTECTED]