summaryrefslogtreecommitdiff
path: root/t/lib/overload_fallback.t
blob: 6b500424757def539aee38f757b4913291eb88fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use warnings;
use strict;
use Test::Simple tests => 2;

use overload '""' => sub { 'stringvalue' }, fallback => 1;

BEGIN {
my $x = bless {}, 'main';
ok ($x eq 'stringvalue', 'fallback worked');
}


# NOTE: delete the next line and this test script will pass
use overload '+' => sub { die "unused"; };

my $x = bless {}, 'main';
ok (eval {$x eq 'stringvalue'}, 'fallback worked again');