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