perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Lee <brett...@yahoo.com>
Subject Re: Registry and CGI::Carp
Date Fri, 27 Jan 2012 22:23:36 GMT
 
Jim,

Thanks for your reply.  Yes, 
that was my post to perlmonks.  set_progname() is a function in the Carp module that lets
you set/reset the name of the Carping script; that way you know which script generated the
logged event.  Another way is to pass 
"name=scriptX" to 'use CGI::Carp'.

> seeing problems with the logging.  The message that is logged is correct,
> however the name of the script that generated the event is not.

The question above was implied; sorry, not ideal for this format.  Being more explicit:

"What is the best way to get CGI::Carp to accurately log the names of Carping Registry scripts?"

Regarding END{}, my inconclusive tests support this:


http://perl.apache.org/docs/2.0/api/ModPerl/Registry.html#C_END__Blocks


Brett





>________________________________
> From: Jim Schueler <jschueler@eloquency.com>
>To: Brett Lee <brettlee@yahoo.com> 
>Cc: modperl <modperl@perl.apache.org> 
>Sent: Friday, January 27, 2012 2:11 PM
>Subject: Re: Registry and CGI::Carp
> 
>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
>> 
>> 
>
>
Mime
View raw message