projects
/
gitmo/Class-C3.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
0776c6a327f2fa7cd2b6a5bee3f0c243cb45c992
[gitmo/Class-C3.git]
/
t
/
34_next_method_in_eval.t
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
45
like(B->foo,
46
qr/^A::foo died/,
47
'method resolved inside eval{}');
48
49