RE: Using Perl END{} with Apache::Registry

2002-11-13 Thread Justin Luster
After doing some additional testing it appears that this problem only
occurs on my Windows machine with Apache 2.0.  I tried it on my Linux
box Apache 1.3 and things worked fine.  Since I am not using Windows in
a production environment I will be OK.

Thanks anyway.



-Original Message-
From: Jim Schueler [mailto:jschueler;tqis.com] 
Sent: Tuesday, November 12, 2002 9:02 PM
To: Justin Luster
Subject: RE: Using Perl END{} with Apache::Registry


Pity that the module doesn't help.

I spent many hours testing END {} block behavior in Apache::Registry and
relied heavily on logged error messages.  I cannot confirm your
hypothesis
that END {} blocks affect error reporting.

When testing code, reliable failures are important.  If it won't fail
predictably, it won't run predictably.  I recommend you double check
your assumption that It seems to be working fine.

Apache::Registry is tricky because it's there's so much uncertainty
about
the state of a process.  For example, it's impossible to determine which
sequence various scripts will run in.  One of the reasons I recommend my
Apache::ChildExit module is because otherwise, all of a process's
encountered END {} blocks are run at the end of a request, including END
{} blocks from other scripts and all modules that have been imported
over
the lifetime of the process.  Apache::ChildExit eliminates the
possibility
that unexpected or unknown END {} blocks will impact the process state
because it ensures that END {} blocks are only run when the process
terminates.

 -Jim


On Tue, 12 Nov 2002, Justin Luster wrote:

 Thanks for the reply.  Unfortunately I need the END block to run for
 every request.  I just was wondering why it altered the way error
 messages were logged.
 
 Thanks.
 
 -Original Message-
 From: Jim Schueler [mailto:jschueler;tqis.com] 
 Sent: Tuesday, November 12, 2002 2:41 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: RE: Using Perl END{} with Apache::Registry
 
 Hello Justin.
 
 I've done a little work on a similar problem due to Apache::Registry's
 unusual treatment of END {} blocks.  You may want to take a look at
 the module I recently submitted:
 
 http://www.cpan.org/authors/id/T/TQ/TQISJIM/ChildExit_0-1.tar.gz
 
  -Jim
 
  Hi, I'm trying to use the END{ } block in my Perl Scripts to do some
  code clean up (making sure files are not locked) at the end of each
  request.  It seems to be working fine.  I'm using Apache::Registry
to
  run a regular Perl script.  I'm having a problem with error
messages.
 
  
   
  
  I have an included file that I'm requiring:
  
   
  
  require test.pl;
  
   
  
  Without the END { } block if the script cannot find test.pl I get a
  Server error 500 and an appropriate error message in the log file.
 When
  I include the END{ } block I get no Server Error and no message in
the
  log file.  It is almost as if the END{ } is overwriting the
  ModPerlRegistry error system.  
  
   
  
  Any ideas?
  
   
  
  Thanks.
 
 
 







Re: Using Perl END{} with Apache::Registry

2002-11-13 Thread Perrin Harkins
Justin Luster wrote:


After doing some additional testing it appears that this problem only
occurs on my Windows machine with Apache 2.0.  I tried it on my Linux
box Apache 1.3 and things worked fine.



That's a key distinction.  Please make sure you say mod_perl 2 when 
that's what you are using.  There is actually no module called 
Apache::Registry in mod_perl 2, so I assumed you meant the 1.x series.

- Perrin



RE: Using Perl END{} with Apache::Registry

2002-11-12 Thread Jim Schueler
Hello Justin.

I've done a little work on a similar problem due to Apache::Registry's
unusual treatment of END {} blocks.  You may want to take a look at
the module I recently submitted:

http://www.cpan.org/authors/id/T/TQ/TQISJIM/ChildExit_0-1.tar.gz

 -Jim

 Hi, I'm trying to use the END{ } block in my Perl Scripts to do some
 code clean up (making sure files are not locked) at the end of each
 request.  It seems to be working fine.  I'm using Apache::Registry to
 run a regular Perl script.  I'm having a problem with error messages.  
 
  
 
 I have an included file that I'm requiring:
 
  
 
 require test.pl;
 
  
 
 Without the END { } block if the script cannot find test.pl I get a
 Server error 500 and an appropriate error message in the log file.  When
 I include the END{ } block I get no Server Error and no message in the
 log file.  It is almost as if the END{ } is overwriting the
 ModPerlRegistry error system.  
 
  
 
 Any ideas?
 
  
 
 Thanks.




RE: Using Perl END{} with Apache::Registry

2002-11-12 Thread Justin Luster
Thanks for the reply.  Unfortunately I need the END block to run for
every request.  I just was wondering why it altered the way error
messages were logged.

Thanks.

-Original Message-
From: Jim Schueler [mailto:jschueler;tqis.com] 
Sent: Tuesday, November 12, 2002 2:41 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: Using Perl END{} with Apache::Registry

Hello Justin.

I've done a little work on a similar problem due to Apache::Registry's
unusual treatment of END {} blocks.  You may want to take a look at
the module I recently submitted:

http://www.cpan.org/authors/id/T/TQ/TQISJIM/ChildExit_0-1.tar.gz

 -Jim

 Hi, I'm trying to use the END{ } block in my Perl Scripts to do some
 code clean up (making sure files are not locked) at the end of each
 request.  It seems to be working fine.  I'm using Apache::Registry to
 run a regular Perl script.  I'm having a problem with error messages.

 
  
 
 I have an included file that I'm requiring:
 
  
 
 require test.pl;
 
  
 
 Without the END { } block if the script cannot find test.pl I get a
 Server error 500 and an appropriate error message in the log file.
When
 I include the END{ } block I get no Server Error and no message in the
 log file.  It is almost as if the END{ } is overwriting the
 ModPerlRegistry error system.  
 
  
 
 Any ideas?
 
  
 
 Thanks.






Re: Using Perl END{} with Apache::Registry

2002-11-12 Thread Perrin Harkins
Justin Luster wrote:


I have an included file that I’m requiring:

require “test.pl”;

Without the END { } block if the script cannot find test.pl I get a
Server error 500 and an appropriate error message in the log file.  When
I include the END{ } block I get no Server Error and no message in the
log file.  It is almost as if the END{ } is overwriting the
ModPerlRegistry error system.



Does it make any difference if you change what's in the END block?

- Perrin





RE: Using Perl END{} with Apache::Registry

2002-11-12 Thread Justin Luster
No.  If there is an END block empty or not then the error logging does
not happen.

By the way do you know of any way to capture what would have been logged
and print it through Apache-something?

Thanks.

-Original Message-
From: Perrin Harkins [mailto:perrin;elem.com] 
Sent: Tuesday, November 12, 2002 3:34 PM
To: Justin Luster
Cc: [EMAIL PROTECTED]
Subject: Re: Using Perl END{} with Apache::Registry

Justin Luster wrote:

 I have an included file that I'm requiring:

 require test.pl;

 Without the END { } block if the script cannot find test.pl I get a
 Server error 500 and an appropriate error message in the log file.
When
 I include the END{ } block I get no Server Error and no message in the
 log file.  It is almost as if the END{ } is overwriting the
 ModPerlRegistry error system.


Does it make any difference if you change what's in the END block?

- Perrin







Re: Using Perl END{} with Apache::Registry

2002-11-12 Thread Kyle Oppenheim
Although I can't reproduce the behavior you describe (I get a message in my
error log plus the END block runs) I have seen something similar in the past
when $@ gets reset by an intervening eval block before Apache::Registry gets
a chance to log an error.  In my case, I had a DESTROY handler on an object
that went out of scope and the DESTROY block had an eval {} block inside of
it.  The presense of the eval {} block reset $@ to .  The result was the
original exception was raised but the value was lost and Apache returned
server error w/o a log message.  (I solved that specific case by localizing
$@ in the DESTROY block.)

It doesn't sound like this applies to you since you said you observed the
faulty behavior w/ an empty END block, but I thought I'd toss it out there
anyway.

- Kyle

- Original Message -
From: Justin Luster [EMAIL PROTECTED]
To: 'Perrin Harkins' [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, November 12, 2002 3:34 PM
Subject: RE: Using Perl END{} with Apache::Registry


 No.  If there is an END block empty or not then the error logging does
 not happen.

 By the way do you know of any way to capture what would have been logged
 and print it through Apache-something?

 Thanks.

 -Original Message-
 From: Perrin Harkins [mailto:perrin;elem.com]
 Sent: Tuesday, November 12, 2002 3:34 PM
 To: Justin Luster
 Cc: [EMAIL PROTECTED]
 Subject: Re: Using Perl END{} with Apache::Registry

 Justin Luster wrote:

  I have an included file that I'm requiring:
 
  require test.pl;
 
  Without the END { } block if the script cannot find test.pl I get a
  Server error 500 and an appropriate error message in the log file.
 When
  I include the END{ } block I get no Server Error and no message in the
  log file.  It is almost as if the END{ } is overwriting the
  ModPerlRegistry error system.


 Does it make any difference if you change what's in the END block?

 - Perrin