Commit | Line | Data |
---|---|---|
204e6232 BF |
1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | use utf8; | |
6 | use open qw( :utf8 :std ); | |
7 | ||
8 | require q(./test.pl); plan(tests => 1); | |
9 | ||
10 | =pod | |
11 | ||
12 | This tests the use of an eval{} block to wrap a next::method call. | |
13 | ||
14 | =cut | |
15 | ||
16 | { | |
17 | package అ; | |
18 | use mro 'c3'; | |
19 | ||
20 | sub ຟǫ { | |
21 | die 'అ::ຟǫ died'; | |
22 | return 'అ::ຟǫ succeeded'; | |
23 | } | |
24 | } | |
25 | ||
26 | { | |
27 | package b; | |
28 | use base 'అ'; | |
29 | use mro 'c3'; | |
30 | ||
31 | sub ຟǫ { | |
32 | eval { | |
33 | return 'b::ຟǫ => ' . (shift)->next::method(); | |
34 | }; | |
35 | ||
36 | if ($@) { | |
37 | return $@; | |
38 | } | |
39 | } | |
40 | } | |
41 | ||
42 | like(b->ຟǫ, | |
43 | qr/^అ::ຟǫ died/u, | |
44 | 'method resolved inside eval{}'); | |
45 | ||
46 |