use Devel::Peek; use B qw( svref_2object SVf_IOK SVf_NOK SVf_POK ); sub is_iv { my $sv = svref_2object(my $ref = \$_[0]); my $flags = $sv->FLAGS; my $x = $sv->PV; if (wantarray) { return ($flags & SVf_IOK, $x); } else { return $flags & SVf_IOK; } } # code to connect to database here $sth = $dbh->prepare(q/select a from PERL_DBD_drop_me/); $sth->execute; $sth->bind_col(1, \$r, {TYPE => SQL_INTEGER}); $sth->fetch; # this will do a sv_setiv($r, 100) is($r, 100, "correct value returned SQL_INTEGER") or Dump($r); my ($iv, $pv) = is_iv($r); ok($iv, "ivok bind integer") or Dump($r); ok($pv, "pv not null bind integer") or Dump($r);