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