I
Ivan Shmakov
BTW, is it common for the DESTROY method to flush any pending
writes associated with the object being destroyed?
The library I'm interested in offers two destructors for one of
its objects: one is "free", which simply deallocates the
object's memory, and the other is "close", which flushes the
pending writes first. It certainly feels more sensible to call
"close" in Perl's DESTROY method, but what do I do if it fails?
AIUI, calling die () in DESTROY is of little use.
The other issue is that given a library's object of type A,
I can request an object of type B (an iterator, in this case) to
be created. Obviously, as this latter object references the
former, I now have some refcounting trickery to do.
Alas, the library doesn't provide a way to retrieve the "parent"
object. Which makes me wonder, will it be sensible to represent
the B type as a (blessed) Perl reference to a list, holding the
pointers to both the "child" and "parent" objects? (The parent
object itself is represented as a reference to its pointer.)
Do I understand it correctly that I get refcounting for granted
in this case?
writes associated with the object being destroyed?
The library I'm interested in offers two destructors for one of
its objects: one is "free", which simply deallocates the
object's memory, and the other is "close", which flushes the
pending writes first. It certainly feels more sensible to call
"close" in Perl's DESTROY method, but what do I do if it fails?
AIUI, calling die () in DESTROY is of little use.
The other issue is that given a library's object of type A,
I can request an object of type B (an iterator, in this case) to
be created. Obviously, as this latter object references the
former, I now have some refcounting trickery to do.
Alas, the library doesn't provide a way to retrieve the "parent"
object. Which makes me wonder, will it be sensible to represent
the B type as a (blessed) Perl reference to a list, holding the
pointers to both the "child" and "parent" objects? (The parent
object itself is represented as a reference to its pointer.)
Do I understand it correctly that I get refcounting for granted
in this case?