in reply to Re: Looking for a function that returns status of a scalar's numeric flags
in thread Looking for a function that returns status of a scalar's numeric flags

You could probably use use B qw/svref_2object/; my $flags = svref_2object(\$val)->FLAGS;

Yes, I think that's the best one for the purpose I have in mind.
I'm thinking of proposing a test to check that List::Util::uniqnum() doesn't alter the numeric flags of its arguments when it doesn't need to.
My latest pull request was initially committing that very sin ... though I've since amended that PR such that uniqnum() no longer does that.
Strikes me that a test to check for such behaviour could be useful, and since List::Util is perl core, the test should utilize core modules only.
IIUC, that makes B the only option .... and therefore the best one ;-)

It's certainly handy to be aware of other candidates - and thank you for drawing my attention to Data::Peek.
I agree that it has a rather nice interface.

Cheers,
Rob
  • Comment on Re^2: Looking for a function that returns status of a scalar's numeric flags
  • Download Code