undef $object;
####
my $object;
sub frobnitz {
$object->do_frobnitz;
};
print "Done";
##
##
sub make_frobnitz {
my $frobnitz;
my $obj = $_[0]; # $object
$frobnitz = sub {
$obj->frobnitz;
};
return $frobnitz # $frobnitz might stay alive forever, keeping $obj alive
};
##
##
sub DESTROY {
my $self = shift;
local $@;
...
my $id = $self->__id();
return unless $self->__id();
my $release_action;
if ($release_action = ($self->__release_action || '')) {
...
};
if ($self->bridge) { # not always there during global destruction
my $rn = $self->bridge->name;
if ($rn) { # not always there during global destruction
...
} else {
# warn "Repl '$rn' has gone away already";
};
1
} else {
if ($MozRepl::RemoteObject::WARN_ON_LEAKS) {
warn "Can't release JS part of object $self / $id ($release_action)";
};
};
}