This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perldelta - move split change to other perlfunc changes and add issue link
[perl5.git] / t / mro / next_ineval.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 require q(./test.pl); plan(tests => 1);
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 AA;
16     use mro 'c3'; 
17
18     sub foo {
19       die 'AA::foo died';
20       return 'AA::foo succeeded';
21     }
22 }
23
24 {
25     package BB;
26     use base 'AA';
27     use mro 'c3'; 
28     
29     sub foo {
30       eval {
31         return 'BB::foo => ' . (shift)->next::method();
32       };
33
34       if ($@) {
35         return $@;
36       }
37     }
38 }
39
40 like(BB->foo,
41    qr/^AA::foo died/,
42    'method resolved inside eval{}');
43
44