NAME

Error - An error object package

SYNOPSIS

    use Error;

    package MyPackage;

    @ISA = qw(Error::Methods);

    sub new {
	...
	...
	$obj = some_function() or
	    return MyPackage->Error(100,"Construction failed");
    }

DESCRIPTION

The Error package provides an object which can be used to pass details about errors back to the user, without actually having to return the error object.

The use of Error also defines a second package Error::Methods. This package defines methods, that can be inherited by other object packages, to ease the creation of Error objects.

There are three ways in which an previous error can be obtained.

$obj->Error

Calling the Error method on an object with no arguments will return the last error that was raised on that object.

Package->Error

Calling Error as a method on a package will return the last error raised on an object blessed into that package,or rasied by a method within that package.

$@

$@ will contain the last error raised by the Error package providing no other event has happened to cause perl to overwrite $@.

EXAMPLES

    my $obj = new SomeObject or
	die SomeObject->Error;

CONSTRUCTOR

AUTHOR

Graham Barr <gbarr@ti.com>

COPYRIGHT

Copyright (c) 1997 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.