use strict; use warnings FATAL => 'all'; use Test::MockObject; use Test::More tests => 2; my $id = -1; package MockFoo; use base qw(Test::MockObject); use overload '""' => sub {return $id}; package main; my $c = MockFoo->new; $c->set_isa('Foo'); $c->set_bound('id', \$id); is($c->id, -1, 'accessor'); is('' . $c, -1, 'stringify');