summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/lib/flush.pl
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/perl/lib/flush.pl')
-rw-r--r--gnu/usr.bin/perl/lib/flush.pl23
1 files changed, 23 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/lib/flush.pl b/gnu/usr.bin/perl/lib/flush.pl
new file mode 100644
index 0000000..55002b9
--- /dev/null
+++ b/gnu/usr.bin/perl/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;
OpenPOWER on IntegriCloud