I have a Perl object that has defined use overload '""' => \&name;
and a name
method.
In my unit tests I have mocked this object, including the name
method, but code like
if (-d $object)
still gives me Use of uninitialized value in -d ...
. The mocked method is not being executed.
My mock code:
my $CMmock = Test::MockObject::Extends->new('MyClass');
$CMmock->mock('name', sub { print "TEST!\n";});
$CMmock->mock('""', sub {print "TEST!\n";});
Other methods that I have mocked are working.