Jesse Luehrs > Try-0.02 > Try

Download:
Try-0.02.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

New  1
Open  0
View/Report Bugs
Module Version: 0.02   Source   Latest Release: Try-0.03

NAME ^

Try - nicer exception handling syntax

VERSION ^

version 0.02

SYNOPSIS ^

    try {
        die "foo";
    }
    catch {
        when (/foo/) {
            warn "Caught foo";
        }
    }

DESCRIPTION ^

This module implements a try/catch/finally statement. It is based heavily on (and mostly implemented via) Try::Tiny. The differences are:

EXPORTS ^

try

try takes a block to run, and catch exceptions from. The block can optionally be followed by catch and another block and finally and another block. The catch block is run when the try block throws an exception, and the exception thrown will be in both $_ and @_. The finally block will be run after the try and catch blocks regardless of what happens, even if the catch block rethrows the exception. The exception thrown will be in @_ but not $_ (this may change in the future, since I'm pretty sure the reasoning for this is no longer useful in 5.14).

BUGS ^

No known bugs.

Please report any bugs through RT: email bug-try at rt.cpan.org, or browse to http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Try.

SEE ALSO ^

Try::Tiny, TryCatch

SUPPORT ^

You can find this documentation for this module with the perldoc command.

    perldoc Try

You can also look for information at:

AUTHOR ^

Jesse Luehrs <doy at cpan dot org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2012 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License
syntax highlighting: