This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Implement the bipolar read-only system
[perl5.git] / t / lib / overload_fallback.t
1 use warnings;
2 use strict;
3 use Test::Simple tests => 2;
4
5 use overload '""' => sub { 'stringvalue' }, fallback => 1;
6
7 BEGIN {
8 my $x = bless {}, 'main';
9 ok ($x eq 'stringvalue', 'fallback worked');
10 }
11
12
13 # NOTE: delete the next line and this test script will pass
14 use overload '+' => sub { die "unused"; };
15
16 my $x = bless {}, 'main';
17 ok (eval {$x eq 'stringvalue'}, 'fallback worked again');
18