Displaying 1 result from an estimated 1 matches for "pre_close".
Did you mean:
pr_close
2010 Jun 10
0
[Bug 602599] New: [RFE] A new API for custom cleanup prior to close in perl bindings
...to exit, the program cannot rely on a destructor to do the
> cleanup as the handle may have been closed before the destructor is
> executed.
>
> A solution to this would be to allow callbacks to be registered and
> executed immediately prior to close(). For example:
>
> $g->pre_close(sub {
> $g->rmdir($self->{foo});
> });
Unfortunately although this looks temptingly simple, it doesn't work
for a variety of reasons.
(1) $g is captured by the closure and so prevents implicit closure.
Of course you can explicitly close the handle now, but it's still very
co...