| Dicop-Base documentation | view source | Contained in the Dicop-Base distribution. |
Dicop::Event - handle error messages in a Dicop system
use Dicop::Event qw/crumble/;
crumble ('Help!');
crumble ('Error 404',404);
Dicop::Error::handler ( \&my_handler );
crumble ('You <B>fail!</B> ;o)'); # display for browser
logger ('logs/server.log','Error','405','No data found.');
sub my_handler
{
my $txt = shift || 'Unknown error';
my $code = shift || 0;
log ($code,$txt);
print "Content-type: text/html\n\n");
print "$code: " if definded $code;
print "$txt\n";
}
perl5.008001, Exporter
Exports crumble, msg, load_messages and logger on demand.
This module exports on demand crumble and event. Use crumble() instead of
die() to pass the error message back to the client and log the error.
Given an error message, this routine displays the message on the screen. All errors are logged to a file, too.
You can set your own error handler via Dicop::Error::handler.
Just like crumble, but dies afterwars.
Log all given args in one line to logfile. First arg is dir and name of logfile.
Load the messages from disk from the given filename.
print msg(100,'foo'); # 'you said ##param1##' becomes 'you said foo'
Return a message for a given message number, and inline any given parameter into the message text.
Set/get error handler.
Given a filename, create a lock on that filename and wait on it until it is free. Used to ensure that only one server object (or thread) accesses the data at a time, to ensure data consistency and integry.
The filename defaults to 'dicop_lockfile'.
This routine is automatically called upon creation of a Dicop::Data object. unlock is used to release the lock upon DESTROY of the object.
Given a filename, remove a potential lock on that file. See also lock.
None known yet.
(c) Bundesamt fuer Sicherheit in der Informationstechnik 1998-2006
DiCoP is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.
See http://www.bsi.de/ for more information.
| Dicop-Base documentation | view source | Contained in the Dicop-Base distribution. |