Nick Ing-Simmons ([EMAIL PROTECTED]) writes: >>d) somehow while the post made >>it to the news server, it didn't make it to the mailing list, and everyone >>else is reading the list from there? > > e) The experts were all busy and haven't been paying attention.
:-) > The thing is you are calling things at quite a low level where you are > expected to know what you are doing ;-) Hey, don't accuse me of that! To know what I'm doing that is! I'm just like a bird picking on the ground and take whatever I find. > But there is a cryptic hint in perlguts.pod > > "Similarly, generic C code must call the > C<SvGETMAGIC()> macro to invoke any 'get' magic if they use an SV > obtained from external sources in functions that don't handle magic. > See L<perlapi> for a description of these functions." > > The trick is > > SvGETMAGIC(sv) which expands to if (SvGMAGICAL(sv)) mg_get(sv); Ah! Precisely, what I was looking for. Many thanks, Nick! I have to admit that I have not read perlguts too well. Mainly I use perlapi, and alas SvGETMAGIC is missing there. What I have read in perlguts is the section "Understanding the Magic of Tied Hashes and Arrays". Here I found the text: av_fetch and the corresponding hash functions hv_fetch and hv_fetch_ent actually return an undefined mortal value whose magic has been initialized using mg_copy. Note the value so returned does not need to be deallocated, as it is already mortal. [MAYCHANGE] But you will need to call mg_get() on the returned value in order to actually invoke the perl level ``FETCH'' method on the underlying TIE object. Whence my use of mg_get(). >>> I found that if I did not add the call to mg_get, SvOK would not return >>> TRUE. ... > > Do you mean a "true" boolean value SvTRUE(sv) or defined value SvOK(sv) ? TRUE in the C++ context, that is, defined value. Again, many thanks Nick! -- Erland Sommarskog, Stockholm, [EMAIL PROTECTED]