Commit | Line | Data |
1a2992bb |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More; |
7 | |
8 | BEGIN { |
9 | plan skip_all => "Perl 5.10 is required" unless eval { require 5.010 }; |
68d55f6d |
10 | plan tests => 3; |
e1e2d16a |
11 | use_ok("Try::Tiny"); |
1a2992bb |
12 | } |
13 | |
1a2992bb |
14 | my ( $error, $topic ); |
15 | |
16 | given ("foo") { |
17 | when (qr/./) { |
18 | try { |
19 | die "blah\n"; |
20 | } catch { |
21 | $topic = $_; |
22 | $error = $_[0]; |
23 | } |
24 | }; |
25 | } |
26 | |
27 | is( $error, "blah\n", "error caught" ); |
28 | |
29 | { |
30 | local $TODO = "perhaps a workaround can be found"; |
31 | is( $topic, $error, 'error is also in $_' ); |
32 | } |
33 | |
1a2992bb |
34 | # ex: set sw=4 et: |
35 | |