koha-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Koha-devel] Re: FAQ: Why am I prompted to save a .pl file? was: Pro


From: Rick Welykochy
Subject: Re: [Koha-devel] Re: FAQ: Why am I prompted to save a .pl file? was: Problems adding a biblio...
Date: Fri, 14 Sep 2007 09:57:19 +1000
User-agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4

Joe Atzberger wrote:

On 9/13/07, *Rick Welykochy* <address@hidden <mailto:address@hidden>> wrote:

    But it will be hard to turn CGI:Carp on in development and off
in production.

Actually, it seems pretty easy to me.
use CGI::Carp qw(fatalsToBrowser);
... # some code ...
fatalsToBrowser(0);  # off
... # more code ...
fatalsToBrowser(1);  # back on

So you can decide to turn it on or off at runtime conditionally, based on whatever you want. You wouldn't have to move code around at all.

Now we are getting somewhere. But we don't want a solution where the
library installer has to edit perl source code, do we?

Suppose my library's security policy is to disallow any errors or
dumps of same to the browser. In this production case, ALL fatals
to browser in all Koha scripts must be disabled.

Rather than forcing the Koha sys admin / installer to edit all the scripts,
this is my proposal:


in a typical koha_whatever.pl script we have:

use CGI::Carp qw(fatalsToBrowser);     # trap errors to error_log and the 
browser
  :
  :
fatalsToBrowser(0) if !Koha::Config->fatalstobrowser;  # trap errors only to 
error_log if so configured


This enables any Koha implementation to (a) see all fatal errors in
error_log at all times and (b) disable the viewing of same in the browser
if they see fit.

All that is then needed is a new entry in /etc/koha.conf

fatalstobrowser=1

and all the installer needs to do once testing is complete and the system
is ready for production (if they want):

fatalstobrowser=0




cheers
rickw


        

--
_________________________________
Rick Welykochy || Praxis Services

Traditionally, most of Australia's imports come from overseas.
     -- Keppel Enderbery




reply via email to

[Prev in Thread] Current Thread [Next in Thread]