NAME

Errors.pm - Full featured error management module

DESCRIPTION

    Error module is created as base "error" catcher module especially for Web

SYNOPSIS

 use Errors::Errors;

 $obj = Errors::Errors->new();
 
 $obj->content(0);
 $obj->header();

 $obj->attach('xreader');  # Attach sub object for error of type 'xreader'
 $obj->attach('myown');    # Attach sub object for error of type 'myown'
 
 $hash = {
	  name=>'July',
	  born_year=>'81',
	 };
 
 $obj->attach_object('xreader',$hash); # Hash ref or object
 
 $obj->install('onTerm',\&custom);
 $obj->install('onError',\&anysub,'xreader');
 $obj->install('onExit',\&leave);
 $obj->install('onTerm',\&custom,'myown');
 
 $obj->error(7,'xreader');
 
 $h = $obj->fetch_object('xreader');
 $obj->print($h->{name});
 
 $obj->uninstall('onError','xreader');
 
 $obj->detach_object('xreader');
 $obj->detach('xreader');
 
 $obj->install('onTimeOut',\&timeout);
 eval 'alarm(2);';
 
 $obj->exit();

 sub custom {
  my $obj   = shift;       # 'Errors' object
  my $err   = shift;       # Error number/message (for TERM it has value 'term')
  my $name  = shift;       # 'name' of error (for TERM it has empty value)
  # ...blah...blah...
 }
 sub leave {
  my $obj   = shift;       # 'Errors' object
  my $err   = shift;       # Last error number/message
  my $name  = shift;       # 'name' of error
  my $how   = shift;       # can be: 'exit','die' or 'destroy'
  # ...blah...blah...
 }
 sub timeout
 {
  my $obj    = shift;      # 'Errors' object
  my $what   = shift;      # 'timeout' string
  # ...blah...blah...
  print "Time OUT";
 }
 sub anysub {
  my $obj   = shift;       # 'Errors' object
  my $err   = shift;       # Error number/message
  my $name  = shift;       # 'name' of error
  if($name =~ m/xreader/si)
   {
    $obj->print ("Error in Xreader!!!");  # If error is raised in 'xreader'
   }
  else
   {
    $obj->print ("Error in ... I don't know :-)!!!");
   }
 }

AUTHOR

Julian Lishev - Bulgaria, Sofia, 
e-mail: julian@proscriptum.com, 
www.proscriptum.com