in reply to Problem on perl callbacks from XS
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem on perl callbacks from XS
by cosimo (Hermit) on May 25, 2008 at 09:04 UTC | |
by tachyon-II (Chaplain) on May 25, 2008 at 15:35 UTC |