I would like to request a user-id for CPAN/PAUSE,
in order to upload the Try.pm module, as follows.

Name:           Tony Olekshy
email:          [EMAIL PROTECTED]
Preferred id:   OLEKSHY

    Perl Language Extensions

    Try  bdph Structured Exception Handling Mechanism  OLEKSHY

This is an implementation in Perl 5 of the functionality described
in Perl 6 RFC 88 (http://tmtowtdi.perl.org/rfc/88.pod).  The syntax
details aren't the same as those in RFC 88, but the overall syntax
and the functionality are the same.

Try.pm lets you do stuff like this:

    use Try;

    exception 'Exception::Foo';
    exception 'Alarm';
    exception 'Error::IO';
    exception 'MyError', isa => 'Exception::Me::Error';

    try sub {};
    try sub {}, catch                 sub {};

    try sub {}, catch "Alarm" =>      sub {};
    try sub {}, catch "Error::IO" =>  sub {};
    try sub {}, catch "Foo", "Bar" => sub {};

    try sub {}, catch sub {}                             => sub {};
    try sub {}, catch sub { $_[0] =~ /foo/ }             => sub {};
    try sub {}, catch sub { grep { $_->isa("Foo") } @_ } => sub {};

    try sub {}, finally sub {};

    try             sub {},
    catch "This" => sub {},
    catch "That" => sub {},
    finally         sub {};

    try %hooks, sub {}, ...;

    throw Exception;
    throw Exception "Can't foo.";
    throw Exception "Can't foo.", data => $data, debug => $debug;

    throw;
    throw "Can't foo.";
    throw "Can't foo.", data => $data, debug => $debug;

    my $e = new Exception;  $e->throw(...);

    $e->{message}
    $e->{data}
    $e->{debug}
    $e->{trace}

    $e->show
    $e->snapshot

    %hooks = (  '""'          => sub { stringify $_[0]       },
                'snapshot'    => sub { return caller() info  },
                'string_wrap' => sub { new Exception::Foo @_ },
             );

In addition to RFC 88, this module has been extensively discussed at
[EMAIL PROTECTED], and was debated on the perl-friends
mailing list in March of 2000.  The current version is closely
related to a version that has been in use at Avra Softare Lab Inc
for the last two years.  It provides functionality similar to
Error.pm, but with a simpler and more extensible interface, with
the addition of the concept of an exception unwind stack, and with
the benefit of all the great contributions on perl6-language-errors.

The current implementation includes over 40 regression tests.  I'm
just finishing off a few more mechanism hooks, and I have to extract
the module documentation out of RFC 88, but I'm working on that now.

Yours, &c, Tony Olekshy

Reply via email to