Re: [cgiapp] Problems with exception handling in CAP::Dispatch

2012-05-16 Thread Michael Lackhoff
On 16.05.2012 01:10 Ron Savage wrote:

 Yes - I remember struggling with this when I forked CGI:App and 
 CGI::App::Dispatch to produce CGI::Snapp and CGI::Snapp::Dispatch.

Thanks Ron for looking into it -- and for the confirmation that there is
a real issue.

 Conclusion: Either way, you're stuffed :-(.

Well, I am still hoping for a fix. If I remember correctly there was a
similar report recently, so there is definately some demand for it.
Forking (or using your or someone elses fork) would be ultima ratio, not
my preferred way of dealing with it...

-Michael


#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####




Re: [cgiapp] Problems with exception handling in CAP::Dispatch

2012-05-15 Thread Ron Savage
Hi Michael

On 16/05/12 00:17, Michael Lackhoff wrote:
 There seems to be something wrong (or at least not very robust) in
 CAP::Dispatch::http_error(). It has the following code:

  warn '[Dispatch] ERROR'
. ($ENV{REQUEST_URI} ?  for request '$ENV{REQUEST_URI}':  : ': ')
. $e-error . \n;

 I guess $e is expected to be an Exception::Class object with an error
 method but when a run mode dies the error seems to be passed as a string
 not an object. So it dies again at this line in http_error with the
 following log message (line numbers slightly different due to a few
 added debug statements):

Yes - I remember struggling with this when I forked CGI:App and 
CGI::App::Dispatch to produce CGI::Snapp and CGI::Snapp::Dispatch.

The problem starts with CAP::Dispatch V 2.18 line 406:
 $output = $self-_run_app($module, $rm, $local_args_to_new);
which at least tells you the app got as far as starting.

In V 3.07, that's line 405.

Then, in _run_app(), lines 713 .. 716 say:
   # otherwise, just pass it up the chain
 } else {
 die $@;
 }
which tells you the code /in this case/ does not call throw_*.

And in V 3.07 that's lines 716 .. 719.

Conclusion: Either way, you're stuffed :-(.

If you don't want to switch to CGI::Snapp etc, or can't, I'd suggest not 
relying on that exception code at all.

Rather: Just do what I did with the re-writes: Add logging code at the 
start of all the major subs, which will simply if crudely tell you 
exactly how far the code is getting before it dies.

HTH

-- 
Ron Savage
http://savage.net.au/
Ph: 0421 920 622

#  CGI::Application community mailing list  
####
##  To unsubscribe, or change your message delivery options,  ##
##  visit:  http://www.erlbaum.net/mailman/listinfo/cgiapp##
####
##  Web archive:   http://www.erlbaum.net/pipermail/cgiapp/   ##
##  Wiki:  http://cgiapp.erlbaum.net/ ##
####