1#!/usr/bin/perl
2
3use strict;
4use warnings;
5use utf8;
6use open qw( :utf8 :std );
7require q(./test.pl); plan(tests => 2);
8
9=pod
10
11This tests the successful handling of a next::method call from within an
12anonymous subroutine.
13
14=cut
15
16{
17    package ㅏ;
18    use mro 'c3';
19
20    sub ᕘ {
21      return 'ㅏ::ᕘ';
22    }
23
24    sub Ḃᛆ {
25      return 'ㅏ::Ḃᛆ';
26    }
27}
28
29{
30    package Ḃ;
31    use base 'ㅏ';
32    use mro 'c3';
33
34    sub ᕘ {
35      my $code = sub {
36        return 'Ḃ::ᕘ => ' . (shift)->next::method();
37      };
38      return (shift)->$code;
39    }
40
41    sub Ḃᛆ {
42      my $code1 = sub {
43        my $code2 = sub {
44          return 'Ḃ::Ḃᛆ => ' . (shift)->next::method();
45        };
46        return (shift)->$code2;
47      };
48      return (shift)->$code1;
49    }
50}
51
52is(Ḃ->ᕘ, "Ḃ::ᕘ => ㅏ::ᕘ",
53   'method resolved inside anonymous sub');
54
55is(Ḃ->Ḃᛆ, "Ḃ::Ḃᛆ => ㅏ::Ḃᛆ",
56   'method resolved inside nested anonymous subs');
57
58
59