Module fails - but nothing is logged

2008-02-09 Thread brett lee

So I've been running my shiny new perl module for a couple weeks now without 
any issues.  I call the module (Nav::Ad) four times (header, footer, left, 
right) from each of my "Registry" scripts.  The Registry scripts parse a html 
file and decide whether to execute the module or just print out the HTML like 
so:

my $COLUMN1 = "$ENV{DOCUMENT_ROOT}/column1.shtml";
  if (open (FILE, $COLUMN1)) {
while () {
  if ( $_ =~ m/printAd.cgi/ ) {
Nav::Ad::printAd( 'Type=column', 'Logo=y', 'Num=7', 'Sep=y');
  } else {
print;
  }
}
close FILE;
  };


I'm in the process of changing the scripts so that it no longer opens a file 
for each of these.  As it stands now, a new module that contains the text in 
each of the four files has been created.  For example, the HTML in column 1 is 
stored in "$column1", and then:

@Column1 = split $/, $column1
sub printcolumn1 {
  foreach (@Column1) {
if ( $_ =~ m/printAd.cgi/ ) {
  Nav::Ad::printAd( 'Type=column', 'Logo=y', 'Num=7', 'Sep=y');
} else {
  print;
}
  };
}

My problem is that this works fine for several requests, but then it fails.  
And when it fails, ALL four (left,right,top,bottom) of the arrays that have 
calls to "printAd" fail.  Never just one, always all four.  The rest of the 
HTML in the arrays is displayed.

In lieu of the expected HTML, the "SCRIPT_NAME" of the Registry script is 
displayed (e.g. /cgi-bin/script.cgi ).

That's all I can find anywhere to help me.  Am running Apache in debug, nothing 
in the logs.

Again, "script.cgi" is a Registry script, and Nav::Ad:: doesn't change between 
FILE-based and Module-based.  Nav::Ad seems to work perfectly when parsing an 
actual file, but when the file is placed into a string in a module it fails 
after some small number of requests and leaves me clueless as to why.

Insight into this would REALLY be appreciated.  Thanks.




  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 



Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread William A. Rowe, Jr.

Foo JH wrote:

Andre,

I've recently set up a test based very closely on your platform:
AP2.2.8
AP5.8.8 Build 822
MP2.0.3


You mention a VC 2005 build of httpd, which build of MP?  2005?

Not sure which uwinnipeg is built against, msvcrt or msvcr80.

But my recent observation is that if you use AS Perl, which is built
against msvcrt, it's likely best to use modperl built against msvcrt
as well.  I'm doubting httpd's clib has a whole lot to do with it.


Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread Foo JH

Andre,

I've recently set up a test based very closely on your platform:
AP2.2.8
AP5.8.8 Build 822
MP2.0.3

The only diff is I got the AP2.2.8 binaries from ApacheLounge. It seems 
to be quite stable so far, including service startups, Apache restarts etc.


André Warnier wrote:

Hi.

I just re-installed a Windows XP Pro SP2 station from scratch after a 
virus infection.
I installed Apache 2.2.8, Activeperl 5.8.8.822 and mod_perl 2.0.3 from 
uwinnipeg.
I cannot start Apache as a Service, crashes with the following message 
in Windows log (it's in German, but you get the drift) :


Fehlgeschlagene Anwendung httpd.exe, Version 2.2.8.0, fehlgeschlagenes 
Modul msvcrt.dll, Version 7.0.2600.2180, Fehleradresse 0x00036fa3.


I can however start the same Apache in a command window, using "httpd 
-e debug -w", it starts fine and answers requests.


Any ideas/suggestions ?

Is my combination of versions above wrong ?

Thanks




Writing a startup module for modperl in Win32

2008-02-09 Thread Foo JH

Hi all,

I've done some refactoring recently on my mp2 app (on Win32), and 
succeeded in resolving the annoying startup issue (basically, does not 
start up well).


I've documented my experience in the following url:
http://jhfoo.multiply.com/journal/item/163/Writing_a_startup_module_for_modperl_in_Win32_Part_1

But for those who just want to know what did the trick, I included a 
simple mechanism to prevent the crashing during file IO:


use Thread::Semaphore;

$MyLib::sem = Thread::Semaphore->new
   if (!defined($MyLib::sem));

$MyLib::sem->down;
# do stuff here
$MyLib::sem->up;


Hope this helps

:






Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread William A. Rowe, Jr.

Randy Kobes wrote:


I've also seen crashes of Apache/2.2.8 with mod_perl
when Apache is started as a service, whereas it's fine
if started from the command line. I'll try the
suggestion in
   http://marc.info/?l=apache-modperl&m=120234507226177&w=2
to see if it's the version of ActivePerl that's the problem.
However, I also noticed one thing - the mod_perl ppm
package was compiled against an earlier ActivePerl,
for binary compatibility with all ActivePerl versions
(in the 8xx series). If I use mod_perl compiled with
ActivePerl 822 against the 2.2.8 Apache sources, then
using it as a service is OK (at least, most of the time;
I still get very occasional crashes).


We might see what compiling the ppm with .pdb files (not sure if you
do that already) - simply /Zi args to CL.exe and /debug /opt:ref to
the linker (rather than /release).  Of course you can unpack the httpd
symbols from the zip file in the dist/httpd/binaries/win32/symbols.zip,
and that leaves only some activestate code 'undebuggable'.

Let's see what that buys us in terms of a dr watson stack unwind during
the crashes you still see?

It sounds like the lofty goal of binary compatibility between 5.8.8
builds wasn't quite realized, eh?

Bill


Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread Randy Kobes

On Sat, 9 Feb 2008, William A. Rowe, Jr. wrote:


Foo JH wrote:

Andre,

I've recently set up a test based very closely on your platform:
AP2.2.8
AP5.8.8 Build 822
MP2.0.3


You mention a VC 2005 build of httpd, which build of MP?  2005?

Not sure which uwinnipeg is built against, msvcrt or msvcr80.


I use VC++ 6 to build the mod_perl ppm packages in the
UWinnipeg repository, which is the same as ActivePerl.


But my recent observation is that if you use AS Perl, which is built
against msvcrt, it's likely best to use modperl built against msvcrt
as well.  I'm doubting httpd's clib has a whole lot to do with it.


I've also seen crashes of Apache/2.2.8 with mod_perl
when Apache is started as a service, whereas it's fine
if started from the command line. I'll try the
suggestion in
   http://marc.info/?l=apache-modperl&m=120234507226177&w=2
to see if it's the version of ActivePerl that's the problem.
However, I also noticed one thing - the mod_perl ppm
package was compiled against an earlier ActivePerl,
for binary compatibility with all ActivePerl versions
(in the 8xx series). If I use mod_perl compiled with
ActivePerl 822 against the 2.2.8 Apache sources, then
using it as a service is OK (at least, most of the time;
I still get very occasional crashes).

--
best regards,
Randy


RE: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread Jan Dubois
On Sat, 09 Feb 2008, William A. Rowe, Jr. wrote:
> Randy Kobes wrote:
> We might see what compiling the ppm with .pdb files (not sure if you
> do that already) - simply /Zi args to CL.exe and /debug /opt:ref to
> the linker (rather than /release).  Of course you can unpack the httpd
> symbols from the zip file in the dist/httpd/binaries/win32/symbols.zip,
> and that leaves only some activestate code 'undebuggable'.

Why is that?  You can download both sources and debugging symbols for
each ActivePerl release.  E.g. for 5.8.8.822:

  http://downloads.activestate.com/ActivePerl/src/5.8/AP822_source.zip

  
http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.822-MSWin32-x86-280952-symbols.zip

The symbols.zip file should be unpacked in the C:\Perl directory, or
wherever you installed ActivePerl as it contains .pdb file for both the
bin and the lib subtree.  All symbols should then automatically fall
into the correct places.

Cheers,
-Jan




Re: Module fails - but nothing is logged

2008-02-09 Thread Perrin Harkins
On Feb 9, 2008 10:31 AM, brett lee <[EMAIL PROTECTED]> wrote:
> My problem is that this works fine for several requests, but then it fails.  
> And when it fails, ALL four (left,right,top,bottom) of the arrays that have 
> calls to "printAd" fail.  Never just one, always all four.  The rest of the 
> HTML in the arrays is displayed.

This could mean that your module does something at runtime like a
require() call which is failing for new processes spawned after the
initial processes die.  I'd suggest either running it under the
debugger or putting in lots of debug logging to see where it is
failing.  You may also want to read this part of the docs:
http://perl.apache.org/docs/1.0/guide/porting.html#Name_collisions_with_Modules_and_libs

- Perrin


Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread Foo JH
I know. ApacheLounge uses a different (newer) compiler, and the 
implications can be quite risky. I've started on this path since the 
earlier 2.2.x when modperl on the ASF binaries has been unreliable, and 
support on the mailing list confirmed my experience more than resolved it.


Why don't you give it a try and see if you're having it better?

William A. Rowe, Jr. wrote:

Foo JH wrote:

Andre,

I've recently set up a test based very closely on your platform:
AP2.2.8
AP5.8.8 Build 822
MP2.0.3


You mention a VC 2005 build of httpd, which build of MP?  2005?

Not sure which uwinnipeg is built against, msvcrt or msvcr80.

But my recent observation is that if you use AS Perl, which is built
against msvcrt, it's likely best to use modperl built against msvcrt
as well.  I'm doubting httpd's clib has a whole lot to do with it.




mod_perl and chroot

2008-02-09 Thread James Breat




Hi,

I am trying to get mod_perl to work in chroot using mod_chroot. It works fine 
without chroot.
This is the error am getting:

"failed
to resolve handler `ModPerl::Registry': Can't locate
ModPerl/Registry.pm in @INC (@INC contains:
/usr/lib/perl5/5.8.8/i486-linux-thread-multi /usr/lib/perl5/5.8.8
/usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl .
/usr/local/srv/apache2) at (eval 2) line 3.\n"

locate Registry.pm returns:
/usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi/ModPerl/Registry.pm

strace
reports:
stat64("/usr/lib/perl5/site_perl/5.8.8/i486-linux-thread-multi/ModPerl/Registry.pm",
0xbfbf20ac) = -1 ENOENT (No such file or directory)

I know php_mod works fine with mod_chroot without having to copy any libs into 
the jail, is mod_perl different?

Thanks.

James

_
Your Future Starts Here. Dream it? Then be it! Find it at www.seek.com.au
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fninemsn%2Eseek%2Ecom%2Eau%2F%3Ftracking%3Dsk%3Ahet%3Ask%3Anine%3A0%3Ahot%3Atext&_t=764565661&_r=OCT07_endtext_Future&_m=EXT

Re: Apache 2.2.6, mod_perl 2.0.3 msvcrt.dll start problem

2008-02-09 Thread William A. Rowe, Jr.

Jan Dubois wrote:

  
http://downloads.activestate.com/ActivePerl/Windows/5.8/ActivePerl-5.8.8.822-MSWin32-x86-280952-symbols.zip

The symbols.zip file should be unpacked in the C:\Perl directory, or
wherever you installed ActivePerl as it contains .pdb file for both the
bin and the lib subtree.  All symbols should then automatically fall
into the correct places.


Excellent, thanks Jan!!!


Trying to configure Apache2::Request

2008-02-09 Thread Mag Gam
I have installed Apache2::Request via CPAN, but i keep getting this message
in my error_log

[error] Global symbol "$r" requires explicit package name at
/var/www/perl/doc.pl line 10.\n

Apache configuration looks like this:
LoadModule perl_module modules/mod_perl.so
LoadModule apreq_module   modules/mod_apreq2.so



AddHandler perl-script .pl
PerlResponseHandler ModPerl::Registry Apache2::Request
PerlOptions +ParseHeaders +GlobalRequest
Options +ExecCGI
DirectoryIndex new_home.pl

PerlModule Apache2::Request



doc.pl looks like this:
#!/usr/bin/perl -w
use strict;
use CGI;
use APR::Request::Apache2 ();


print "Content-type: text/html\n\n";
print "Hello";

my $req = Apache2::Request->new($r, POST_MAX => "1M");


Any thoughts?

TIA