Bundesamt für Sicherheit in der Informationstechnik > Dicop-Base-3.05 > Dicop::Event

Download:
dicop/Dicop-Base-3.05.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 1.04   Source  

NAME ^

Dicop::Event - handle error messages in a Dicop system

SYNOPSIS ^

        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";
          }

REQUIRES ^

perl5.008001, Exporter

EXPORTS ^

Exports crumble, msg, load_messages and logger on demand.

DESCRIPTION ^

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.

METHODS ^

crumble

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.

give_up

Just like crumble, but dies afterwars.

logger

Log all given args in one line to logfile. First arg is dir and name of logfile.

load_messages

Load the messages from disk from the given filename.

msg

        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.

handler

Set/get error handler.

lock

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.

unlock

Given a filename, remove a potential lock on that file. See also lock.

BUGS ^

None known yet.

AUTHOR ^

(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.