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.
In reply to Re^2: Change a SCALAR into a HASH using just Perl without any XS code?
by tod222
in thread Change a SCALAR into a HASH using just Perl without any XS code?
by tod222
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |