1#!./perl
2
3BEGIN {
4    chdir 't' if -d 't';
5    push @INC, '../lib';
6    require './test.pl';
7}
8
9use strict;
10use warnings;
11
12plan tests => 2;
13
14package Foo;
15
16use overload;
17
18sub import
19{
20    overload::constant 'integer' => sub { return shift };
21}
22
23package main;
24
25BEGIN { $INC{'Foo.pm'} = "/lib/Foo.pm" }
26
27use Foo;
28
29my $result = eval "5+6";
30my $error = $@;
31$result //= '';
32
33is ($error, '', "No exception was thrown with an overload::constant 'integer' inside an eval.");
34is ($result, 11, "Correct solution");
35
36