Try to avoid over-optimising. Consider that any time an exception occurs that that 
occurance is an _exception_ to the norm. So it
shouldn't happen frequently to begin with.  Optimisations are best focused on what is 
normal, not what is unusual.

-Stephen

-----Original Message-----
From: Odounga y'Oyabi [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 17, 2001 10:01 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: RE: [cgiapp] Error Handling with CGI::Application


Thanks for the quick reply. I've thought of doing this. The problem is I
don't think it's efficient since I have to open and return a template every
time an exception occurred.

This means, instead of two simple lines

warn "blablabla!\n";
return;

I will have

my $template = HTML::Template->new( filename => "error_screen" );
  $template->param(
                   VERSION  => $VERSION,
                   RELEASE   => $RELEASE,
                   RUN_MODE  => 'this_run_mode',
                   ERROR_MSG => 'Something weird occurred!\n"
                  );
  return $template->output;

I will have three lines of code!

I was looking for something like a call to a specialized routine whic´h got
the error message passed in. Like the "AUTOLOAD" run-mode. Unfortunately, I
don't know how to pass an error message to the method which is called by
"AUTOLOAD" and don't even know how to cause this method to be called.

Loads'f thanks for your feedback. Your answer is probably the easiest way.




Roses Longin Odounga

Netset Consulting
Falltorweg 4
D-65428 Rüsselsheim
Tel. +49 (0) 6142 - 938978
GSM  +49 (0) 173  - 3201063
Mailto [EMAIL PROTECTED]
http://www.gabon-net.com



>From: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: RE: [cgiapp] Error Handling with CGI::Application
>Date: Wed, 17 Oct 2001 09:35:28 -0400
>
>
>Warn will pump it into the web servers logs not out to the browser.
>
>I've done a few things to handle what your thinking:
>
>Use 'die' instead of warn with fatalsToBrowser turned on for CGI (Search
>CGI.pm documentation for fatalsToBrowser
>
>For a neater appearance, make a template and stick the error code into
>it and return it instead
>
>Another thing I do is make a sysmessage field in my templates in a
>comment block.  I set it to whatever debug info I want to drop - when I
>get the page I view source and there is all my benchmarking, warnings,
>etc...
>
>
>-----Original Message-----
>From: odounga [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, October 17, 2001 7:46 AM
>To: cgiapp
>Subject: [cgiapp] Error Handling with CGI::Application
>
>
>Hi!
>
>I'm a Perl novice and currently trying to develop a CGI::Application
>based
>web-system.
>
>I can't figure out how to display an error page to the user when an
>exception occurred in a sub called by a run-mode.
>
>In the sub I'm doing a conditional like this
>
>unless ( $object->do_yourself() ) {
>   warn "CRITICAL: Error, object can not do itself!\n";
>   return;
>}
>
>I'm looking for a mechanism for returning this error message to the
>browser.
>Currently, it just warn "Document contains no data" and didn't update
>the
>screen.
>
>Thanks for your support and invaluable time.
>
>Regards,
>
>Roses Longin Odounga
>
>Falltorweg 4
>D-65428 Rüsselsheim
>Tel. +49 (0) 6142 - 938978
>GSM  +49 (0) 173  - 3201063
>Mailto [EMAIL PROTECTED]
>http://www.gabon-net.com
>
>
>_________________________________________________________________
>Downloaden Sie MSN Explorer kostenlos unter
>http://explorer.msn.de/intl.asp
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


_________________________________________________________________
Downloaden Sie MSN Explorer kostenlos unter http://explorer.msn.de/intl.asp


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to