in reply to Re: Change a SCALAR into a HASH using just Perl without any XS code?
in thread Change a SCALAR into a HASH using just Perl without any XS code?
You're right, I didn't specify a value for the hash, because it doesn't contain anything -- it's XS code acting like a hash, or in the problematic case, XS code acting like a scalar.
I tried the following which appeared to work in a trivial test case, but it corrupted memory causing a Segfault in another location when I tested it in real code:
my $aref = $f->getVariants(); # reference to array containing many Foo my $sfoo = shift(@$aref); my $tiefoo = {}; # warning - this causes segfaults bless $tiefoo, 'Bar::Foo'; tie %{$tiefoo}, 'Bar::Foo', $sfoo; $tiefoo->ACQUIRE();
So my conclusion is that it's not possible to fix this in pure Perl. The C++ or SWIG wrapper code must be modified.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Change a SCALAR into a HASH using just Perl without any XS code?
by ikegami (Patriarch) on Nov 01, 2010 at 15:57 UTC |