diff options
Diffstat (limited to 'contrib/perl5/lib/flush.pl')
-rw-r--r-- | contrib/perl5/lib/flush.pl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/contrib/perl5/lib/flush.pl b/contrib/perl5/lib/flush.pl new file mode 100644 index 000000000000..55002b9919c7 --- /dev/null +++ b/contrib/perl5/lib/flush.pl @@ -0,0 +1,23 @@ +;# Usage: &flush(FILEHANDLE) +;# flushes the named filehandle + +;# Usage: &printflush(FILEHANDLE, "prompt: ") +;# prints arguments and flushes filehandle + +sub flush { + local($old) = select(shift); + $| = 1; + print ""; + $| = 0; + select($old); +} + +sub printflush { + local($old) = select(shift); + $| = 1; + print @_; + $| = 0; + select($old); +} + +1; |