This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
untodo the no-longer-failing todo test for rgs' patch
[perl5.git] / lib / flush.pl
1 #
2 # This library is no longer being maintained, and is included for backward
3 # compatibility with Perl 4 programs which may require it.
4 # This legacy library is deprecated and will be removed in a future
5 # release of perl.
6 #
7 # In particular, this should not be used as an example of modern Perl
8 # programming techniques.
9 #
10 # Suggested alternative: IO::Handle
11
12 warn( "The 'flush.pl' legacy library is deprecated and will be"
13       . " removed in the next major release of perl. Please use the"
14       . " IO::Handle module instead." );
15
16 ;# Usage: &flush(FILEHANDLE)
17 ;# flushes the named filehandle
18
19 ;# Usage: &printflush(FILEHANDLE, "prompt: ")
20 ;# prints arguments and flushes filehandle
21
22 sub flush {
23     local($old) = select(shift);
24     $| = 1;
25     print "";
26     $| = 0;
27     select($old);
28 }
29
30 sub printflush {
31     local($old) = select(shift);
32     $| = 1;
33     print @_;
34     $| = 0;
35     select($old);
36 }
37
38 1;