Commit | Line | Data |
2605e591 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 2; |
7 | |
8 | BEGIN { use_ok('Class::C3::XS') } |
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 A; |
18 | |
19 | sub foo { |
20 | die 'A::foo died'; |
21 | return 'A::foo succeeded'; |
22 | } |
23 | } |
24 | |
25 | { |
26 | package B; |
27 | use base 'A'; |
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 | |