in reply to Confusion over B::PV
my $x = $sv->can('PVX') ? $sv->PVX : undef;
But why are you checking that?! It's equally correct for it to be present and absent.
use strict; use warnings; use Test::More tests => 3; 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 $pv = $sv->can('PVX') ? $sv->PVX : undef; if (wantarray) { return ($flags & SVf_IOK, $pv); } else { return $flags & SVf_IOK; } } my $r = "100"; $r = 100; Dump($r); my ($iv, $pv) = is_iv($r); is($r, 100, "correct value returned SQL_INTEGER"); ok($iv, "ivok bind integer"); ok($pv, "pv not null bind integer");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Confusion over B::PV
by mje (Curate) on May 19, 2012 at 17:14 UTC | |
by ikegami (Patriarch) on May 20, 2012 at 03:21 UTC |