package InlineTest; use strict; use warnings; use Inline qw(NOCLEAN INFO); use Inline 'C' => <<'CEND'; SV* x (HV* self) { SV** xp = hv_fetch(self, "x", 1, 0); /* Increment the ref count because XS mortalizes any returned SV* */ return xp ? SvREFCNT_inc(*xp) : &PL_sv_undef; } CEND sub new { my $self = shift; return bless {@_}, $self; } package main; use strict; use warnings; my $t = InlineTest->new( x => 'foo' ); print $t->x, "\n"; #### sub Whiner::DESTROY { print "Dying!\n" } my $t = InlineTest->new( x => bless [], 'Whiner' ); print $t->x, "\n"; undef $t; print "Done.\n";