You could do the double indirection thing.
That is, instead of passing the SV that wraps your C++ object to the Perl code, pass an SvRV that points to that SV. Then your Perl code would have to indirect through the SvRV to get at the object
my $cppOref = shift; return unless $$cppOref; $$cppOref->whatever
That way, your C++ destructor can undef the SV, and any copies of the SvRV that the Perl code has retain will point to undef. It won't stop someone making a copy of the dereferenced SV: my $sneaky = $$cppOref; and falling in a heap by trying to use it later, but that's an education thing.
In reply to Re: perl embedded in C++: how to undefine perl objects that are blessed references to C++ objects when the C++ object destructs
by BrowserUk
in thread perl embedded in C++: how to undefine perl objects that are blessed references to C++ objects when the C++ object destructs
by kingkongrevenge
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |