1Devel::Autoflush(3) User Contributed Perl Documentation Devel::Autoflush(3)
2
3
4
6 Devel::Autoflush - Set autoflush from the command line
7
9 version 0.06
10
12 perl -MDevel::Autoflush Makefile.PL
13
15 This module is a hack to set autoflush for STDOUT and STDERR from the
16 command line or from "PERL5OPT" for code that needs it but doesn't have
17 it.
18
19 This often happens when prompting:
20
21 # guess.pl
22 print "Guess a number: ";
23 my $n = <STDIN>;
24
25 As long as the output is going to a terminal, the prompt is flushed
26 when STDIN is read. However, if the output is being piped, the print
27 statement will not automatically be flushed, no prompt will be seen and
28 the program will silently appear to hang while waiting for input. This
29 might happen with 'tee':
30
31 $ perl guess.pl | tee capture.out
32
33 Use Devel::Autoflush to work around this:
34
35 $ perl -MDevel::Autoflush guess.pl | tee capture.out
36
37 Or set it in "PERL5OPT":
38
39 $ export PERL5OPT=-MDevel::Autoflush
40 $ perl guess.pl | tee capture.out
41
42 = SEE ALSO
43
44 • CPANPLUS::Internals::Utils::Autoflush -- same idea but STDOUT only
45 and
46
47 only available as part of the full CPANPLUS distribution
48
50 Bugs / Feature Requests
51 Please report any bugs or feature requests through the issue tracker at
52 <https://github.com/dagolden/Devel-Autoflush/issues>. You will be
53 notified automatically of any progress on your issue.
54
55 Source Code
56 This is open source software. The code repository is available for
57 public review and contribution under the terms of the license.
58
59 <https://github.com/dagolden/Devel-Autoflush>
60
61 git clone https://github.com/dagolden/Devel-Autoflush.git
62
64 David Golden <dagolden@cpan.org>
65
67 This software is Copyright (c) 2014 by David Golden.
68
69 This is free software, licensed under:
70
71 The Apache License, Version 2.0, January 2004
72
73
74
75perl v5.32.1 2021-01-27 Devel::Autoflush(3)