Subject: | Can't retrieve reference from struct member |
Date: | Thu, 25 Sep 2014 23:28:48 +0200 |
To: | bug-Inline-Struct [...] rt.cpan.org |
From: | Heinz Knutzen <heinz.knutzen [...] gmail.com> |
I want to use Inline::Struct as a memory efficient replacement for small
hashes with a fixed set of keys.
The values of these hashes are references to other hashes.
Currently Inline::Struct fails if I try to retrieve a reference from a
struct.
This example program
============================================
use Inline C => <<'END', STRUCTS => 1;
struct Foo {
SV *hash;
};
END
my $o = Inline::Struct::Foo->new();
$o->hash({ a => { b => 'c' } });
print $o->hash()->{a}->{b}, "\n";
============================================
fails with
Can't use an undefined value as a HASH reference at inline-struct-SV.pl
line 9.
Attempt to free unreferenced scalar: SV 0x9fbed98 at inline-struct-SV.pl
line 9.
Used versions:
- Inline-Struct-0.11
- Perl v5.18.2