syphilis has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
By "numeric flags", I'm referring to the "IOK", "pIOK", "NOK", "pNOK" and the "IsUV" flags (as presented by Devel::Peek::Dump).
But rather than have this information displayed, I'm looking for a sub that returns the status of these specific flags. That is, something like:
Is there already a module on CPAN that will return the status of those 5 flags ?
I know how to find the status of "IOK", "NOK" and "IsUV" in XS.
One can merely test the truth of SvIOK(sv), SvNOK(sv) and SvUOK(sv) respectively.
But how does one establish, in XS, whether the "pIOK" and "pNOK" flags are set ?
Maybe there's another way to approach this.
The key thing is that I want to be able to programmatically catch the occurrence of foo() altering its argument's "numeric flags".
Cheers,
Rob
By "numeric flags", I'm referring to the "IOK", "pIOK", "NOK", "pNOK" and the "IsUV" flags (as presented by Devel::Peek::Dump).
But rather than have this information displayed, I'm looking for a sub that returns the status of these specific flags. That is, something like:
The aim is to be able to determine whether a subroutine call changes the status of any of those flags on the subroutine's argument. That is:sub flag_status { my $v = $_[0]; return is_IOK($v) | is_pIOK($v) | is_IsUV($v) | is_NOK($v) | is_pNOK($v); } sub is_IOK { # return 1 if argument's IOK flag is set # else return 0 } sub is_pIOK { # return 2 if argument's pIOK flag is set # else return 0 } sub is_NOK { # return 4 if argument's NOK flag is set # else return 0 } sub is_pNOK { # return 8 if argument's pNOK flag is set # else return 0 } sub is_IsUV { # return 16 if argument's IsUV flag is set # else return 0 }
Is there already a perl module that ships with the core that will return the status of those 5 flags ?my $d = 2.7; my $flags_prior = flag_status($d); foo($d); my $flags_after = flag_status($d); die "foo() altered its argument's numeric flags" if($flags_prior != $flags_after);
Is there already a module on CPAN that will return the status of those 5 flags ?
I know how to find the status of "IOK", "NOK" and "IsUV" in XS.
One can merely test the truth of SvIOK(sv), SvNOK(sv) and SvUOK(sv) respectively.
But how does one establish, in XS, whether the "pIOK" and "pNOK" flags are set ?
Maybe there's another way to approach this.
The key thing is that I want to be able to programmatically catch the occurrence of foo() altering its argument's "numeric flags".
Cheers,
Rob
|
---|
Back to
Seekers of Perl Wisdom