use strict; sub isMoreThanTen { my ( $sth ) = shift; my $count = undef; $sth->bind_param_inout(\$count); return $count > 10 ? 1 : 0; } use Test::MockObject; my $msth = Test::MockObject->new(); # Attempting to return by reference... $msth->mock('bind_param_inout',sub { $_[0] = 11; }); if ( isMoreThanTen($msth) ) { print "More than 10\n"; } else { print "Less than or equal to 10\n"; }