When an hashref is really a blessed object, I want its toString() method to be called to dump the hashref content to my result SV. Calling the object's toString() method is the task for the code I shown you.
But why do you need to go to XS and back to do that? I appreciate this is probably a simplified example but if the thing you want to serialise already has a toString method to serialise it in Perl AND you want to return this in your results SV why do that in a round about way in XS?
sub serialise { my $ref = shift; my $str = undef; eval{ $str = $ref->toString }; return $str if defined $str; $str = XS_serialise($ref); return $str; }
In reply to Re: Problem on perl callbacks from XS
by tachyon-II
in thread Problem on perl callbacks from XS
by cosimo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |