Registry and CGI::Carp

2012-01-27 Thread Brett Lee
Hi Folks,

Running several scripts under ModPerl::Registry that use CGI::Carp.  Am seeing 
problems with the logging.  The message that is logged is correct, however the 
name of the script that generated the event is not.

Each script contains a line similar to:

use CGI::Carp qw(name=my_script_X);

When the scripts are precompiled in startup.pl, the *same* script name is 
logged for each and every script.  When scripts are not precompiled the name is 
frequently correct, but it is not correct all of the time.

A post earlier to Perl Monks came back with the suggestion to extend 
CGI::Carp.pm to support running under Registry.  As what I am trying to do 
seems like it would be a pretty common scenario, am thinking there may be 
another option.

Thanks for considering this one.
Brett


Re: Registry and CGI::Carp

2012-01-27 Thread Jim Schueler
There's no question or anything resembling a request in your email.  So my 
response may waste a lot of time.


Is this your original post?
  http://www.perlmonks.org/?node_id=949773

If so, I might be able to help.

Admittedly, I can't follow the thread.  The PerlMonds responder refers to 
a function set_progname().  But I can't figure out what that refers to.


However, in the third exchange, you referenced a problem I have some 
experience with:  Apache::Registry executes the BEGIN{} block once, and 
the END{} block repeatedly.  Fundamentally, the Perl specification expects 
them to be balanced, and I'm still amazed at this shortcoming.  I wrote a 
workaround that might get you over your hurdle.  Please check out 
Apache::ChildExit.


I'm amazed that my solution wasn't generally adopted.  As you note, it 
seems like this would be a pretty common scenario.  Give it a try, and 
please let me know whether this solution gives you any traction.


Cheers!

 -Jim



On Fri, 27 Jan 2012, Brett Lee wrote:


Hi Folks,

Running several scripts under ModPerl::Registry that use CGI::Carp.  Am
seeing problems with the logging.  The message that is logged is correct,
however the name of the script that generated the event is not.

Each script contains a line similar to:

use CGI::Carp qw(name=my_script_X);

When the scripts are precompiled in startup.pl, the *same* script name is
logged for each and every script.  When scripts are not precompiled the name
is frequently correct, but it is not correct all of the time.

A post earlier to Perl Monks came back with the suggestion to extend
CGI::Carp.pm to support running under Registry.  As what I am trying to do
seems like it would be a pretty common scenario, am thinking there may be
another option.

Thanks for considering this one.
Brett