This is a bug report for perl from spider@Orb.Nashua.NH.US,
If you're lucky enough to get a signal (such as ALRM) which is handled
with die() while in a SelectSaver->new($fh) call, your previous output
filehandle is not restored. It violates the basic rule of 'save and
restore' handling, in that it modifies the state it wants to restore
I<before> it has ensured that the prior state will be restored. Patch:
p5p-msgid:
199703291906.OAA07232@Orb.Nashua.NH.US
sub new {
@_ >= 1 && @_ <= 2 or croak 'usage: new SelectSaver [FILEHANDLE]';
- my $fh = (@_ > 1) ? (select qualify($_[1], caller)) : select;
- bless [$fh], $_[0];
+ my $fh = select;
+ my $self = bless [$fh], $_[0];
+ select qualify($_[1], caller) if @_ > 1;
+ $self;
}
sub DESTROY {