Subject: | Call stop on destruction |
It would be handy if the object stopped itself when it went out of scope
since that seems to be the only reason I can think of to use an object
in the first place. :)
Here's what I was doing:
try {
my $c = IO::Capture::Stderr->new;
$c->start;
$rev = git::rev_parse($rev) || git::rev_parse("origin/$rev");
}
catch {
die "Don't know what $rev is\n";
};
As it is, $c has to be declared outside the try block because I need to
use it in the catch to stop it so that die actually dies to STDERR; but
the effects of $c were intended only for the contents of the try, so it
seems sensible to end its effects when it goes out of scope.