#!/usr/bin/perl

# Copyright 2006-2025, Paul Johnson (paul@pjcj.net)

# This software is free.  It is licensed under the same terms as Perl itself.

# The latest version of this software should be available from my homepage:
# https://pjcj.net

package Foo;
use overload
   '""' => sub { shift->render},
   bool => sub { die "I was used as a bool and shouldn't be\n"; 1 };

sub render {
   "foo";
}

my $foo = 1;
bless {}, 'Foo' if $foo;

my $boolobj = bless {}, 'Foo';
$boolobj //= 5;
my $var; $var //= bless {}, "Foo";

1;
