Commit | Line | Data |
ac6b0914 |
1 | #!/usr/bin/perl |
2 | |
3 | use strict; |
4 | use warnings; |
5 | |
6 | use Test::More tests => 2; |
7 | |
8 | BEGIN { |
9 | use lib 'opt', '../opt', '..'; |
10 | use_ok('c3'); |
11 | } |
12 | |
13 | =pod |
14 | |
15 | This tests the use of an eval{} block to wrap a next::method call. |
16 | |
17 | =cut |
18 | |
19 | { |
20 | package A; |
21 | use c3; |
22 | |
23 | sub foo { |
24 | die 'A::foo died'; |
25 | return 'A::foo succeeded'; |
26 | } |
27 | } |
28 | |
29 | { |
30 | package B; |
31 | use base 'A'; |
32 | use c3; |
33 | |
34 | sub foo { |
35 | eval { |
36 | return 'B::foo => ' . (shift)->next::method(); |
37 | }; |
38 | |
39 | if ($@) { |
40 | return $@; |
41 | } |
42 | } |
43 | } |
44 | |
2ffffc6d |
45 | Class::C3::initialize(); |
46 | |
ac6b0914 |
47 | like(B->foo, |
48 | qr/^A::foo died/, |
49 | 'method resolved inside eval{}'); |
50 | |
51 | |