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