sub DESTROY {
my $class = shift;
return if ${^GLOBAL_PHASE} eq 'DESTRUCT';
$class->{handle}->close() if defined $class->{handle};
}
However, as mentioned elsewhere, $class->{handle} is *only* used in your destructor, so it's not really a useful line of code. Then, going backwards through the destructor, there's nothing happening that needs to be done. So removing the destructor would be the correct solution. But since you said it's a sample of your code, you might've removed a subroutine or two that could potentially set the handle member. In that case, this change should clear things up for you.
...roboticus
When your only tool is a hammer, all problems look like your thumb. |