But what does it really mean?
The POK flag indicates that the stored PV is valid and can be used.
The pPOK flag is used internally by the magic system to establish that the PV is valid.
(And similarly for "I" and "N".)
I don't know if it's still the case that one can be set without the other.
I found an example in section 4.3 of "Extending and Embedding Perl" by Jenness and Cousins that sets pPOK without setting POK - but only on perl-5.16 and perhaps (unchecked) earlier perl versions.
On perl-5.18 and later the same code sets both POK and pPOK.
Obviously there's no need for both unless they sometimes need to be set by themselves.
Here's that demo from "Extending and Embedding Perl":
C:\_32\pscrpt>type TieFoo.pm
package TieFoo;
sub TIESCALAR {
my $obj = "foo1";
return bless(\$obj, "TieFoo");
}
sub FETCH {
${ $_[0] }++;
}
1;
C:\_32\pscrpt>type demo.pl
use Devel::Peek;
use lib '.';
use TieFoo;
tie $a, 'TieFoo';
print "Initial State: \n";
Dump $a;
print "\nFirst Value: $a\n\n";
print "State after a FETCH: \n";
Dump $a;
On perl-5.16, the final Dump() begins:
State after a FETCH:
SV = PVMG(0x1cd4f9c) at 0x1cdf054
REFCNT = 1
FLAGS = (GMG,SMG,RMG,pPOK)
...
On later versions of perl that changes to:
State after a FETCH:
SV = PVMG(0x7deea8) at 0x7cbc58
REFCNT = 1
FLAGS = (GMG,SMG,RMG,POK,IsCOW,pPOK)
....
According to Jenness and Cousins, that pPOK indicates that a cached value is available (though that cached value gets overwritten with every FETCH).
Sorry - probably not much help.
Hopefully there's someone kicking around that can do better.
Cheers, Rob
|