NAME

Throw - Simple exceptions that do the right things in multiple contexts

SYNOPSIS

use Throw qw(throw);

throw "Hey";

throw "Hey", {info => "This is why"};

throw "Hey", {trace => 1}; # simple trace

throw "Hey", {trace => 2}; # full trace without args

throw "Hey", {trace => 3}; # full trace with args


use Throw qw(croak confess carp);

croak "Hey";  # same as throw with {trace => 1}, 1

confess "Hey";  # same as throw with {trace => 2}

carp "Hey";  # warns from perspective of caller

warn Throw->new("Hey");  # useful for some cases


use Throw qw(throw classify);
if (classify my $err = $@, "io") {
    throw "Got a disk error", {msg => $err};
}

DESCRIPTION

Throw allows for light weight exceptions that can hold more information than just the error message. These exceptions do the right thing when thrown on the commandline, or when consumed by javascript based APIs.

METHODS

GLOBALS

There are also a few package globals that can make tracking down culprits easier.