Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Then later I try to restore the stream using:local *REAL_STDIN; open(REAL_STDIN, ">&STDIN"); $this->{'_stdin'} = *REAL_STDIN;
And when I try to run it, I get -3. The same approach works fine with STDERR and STDOUT (though in the restore code they need something like:if (defined($this->{'_stdin'})){ local *REAL_STDIN = $this->{'_stdin'}; if(!(open STDIN, "&REAL_STDIN")){ return -3; } }
#<snip> if(!(open STDOUT, ">>&STDOUT")){ #<snip>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Save/restore STDIN
by Zaxo (Archbishop) on Sep 06, 2003 at 00:22 UTC | |
|
Re: Save/restore STDIN
by CountZero (Bishop) on Sep 06, 2003 at 09:53 UTC | |
by Roger (Parson) on Sep 07, 2003 at 23:00 UTC | |
|
Re: Save/restore STDIN
by Limbic~Region (Chancellor) on Sep 05, 2003 at 19:05 UTC | |
|
Re: Save/restore STDIN
by gmpassos (Priest) on Sep 09, 2003 at 03:41 UTC |