use SelectSaver; select $fh_old; { my $saver = new SelectSaver($fh_new); # selects $fh_new } # block ends; object pointed to by "my" $saver is destroyed # previous handle, $fh_old is now selected # alternative invocation, without filehandle argument my $saver = new SelectSaver; # selected filehandle remains unchanged
A SelectSaver object contains a reference to the filehandle that was selected when the object was created. If its
new()
method is given a filehandle as an argument, then that filehandle is selected; otherwise, the selected filehandle remains unchanged.
When a SelectSaver object is destroyed, the filehandle that was selected immediately prior to the object's creation is re-selected.
7.2.53 Search::Dict - Search for Key in Dictionary File | 7.2.55 SelfLoader - Load Functions Only on Demand |