TDL::Admin and TDL::Error

Source

TDL::Admin
TDL::Error

Description

These files provide administrative control and enhanced error reporting for a website.

TDL::Admin defines the following procedures:
adminReport Provides a detailed report on whether the current user and/or IP qualifies as an administrator.
adminReport()
dumpEnvironment Dumps the CGI environment to the dump directory.
dumpEnvironment()
formatCGI Formats the CGI environment as a table and writes the result into an open file.
formatCGI(*F}
isAdmin Returns 1 if the current user and/or IP address qualifies as an administrator.
boolean isAdmin()
printEnvironmentFormats the current environment (CGI and parameters) and writes the result into an open file.
printEnvironment()


TDL::Error defines the following procedures:
error Replacement for carp_error that provides a more detailed error report if the current user or IP is an administrator. The output will contain the offending source line (if a Perl script) and any messages that have been written to the system error log since the script begain processing.
error($message)
Register Used to register the CGI object created by the script (so that TDL::Error does not need to create its own.
TDL::Error::Register($q)

The error reporting works best if you hack your copy of CGI::Carp so that CGI::Carp::fatalsToBrowser is modified as follows:

  print STDOUT "Content-type: text/html\n\n" 
    unless $mod_perl or exists $ENV{TDL};

That change will prevent spurious "Content-type: text/html" output from being emitted by Carp.


Send me reports of any errors or suggestions you have about my Perl scripts.


The code described on this page is Copyright 2003, 2007 Tony Lewis <tlewis@exelana.com>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.