1SelectSaver(3pm) Perl Programmers Reference Guide SelectSaver(3pm)
2
3
4
6 SelectSaver - save and restore selected file handle
7
9 use SelectSaver;
10
11 {
12 my $saver = SelectSaver->new(FILEHANDLE);
13 # FILEHANDLE is selected
14 }
15 # previous handle is selected
16
17 {
18 my $saver = SelectSaver->new;
19 # new handle may be selected, or not
20 }
21 # previous handle is selected
22
24 A "SelectSaver" object contains a reference to the file handle that was
25 selected when it was created. If its "new" method gets an extra
26 parameter, then that parameter is selected; otherwise, the selected
27 file handle remains unchanged.
28
29 When a "SelectSaver" is destroyed, it re-selects the file handle that
30 was selected when it was created.
31
32
33
34perl v5.26.3 2018-03-01 SelectSaver(3pm)