Devel::Autoflush(3pm)

πŸ“¦
version 0.06 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ NAME ✨

Devel::Autoflush β€” bestie, it sets autoflush straight from the command line πŸ’…

🌸 VERSION 🌸

version 0.06 β€” yes she's on 0.06, iconic behavior

πŸ¦‹ SYNOPSIS πŸ¦‹

perl -MDevel::Autoflush Makefile.PL

like that's it, that's the whole vibe


πŸ’– DESCRIPTION πŸ’–

okay so real talk: this module is a hack (the author's word, not mine, and honestly we respect the honesty) that turns on autoflush for STDOUT and STDERR from the command line, or from PERL5OPT, for code that needs it but doesn't have it. no cap.

when does this happen? bestie, it happens when you're prompting someone:

# guess.pl
print "Guess a number: ";
my $n = <STDIN>;

so here's the tea 🍡 β€” as long as the output is going to a terminal, that prompt gets flushed when STDIN is read. cute. fine. normal.

BUT β€” and this is the part that ruins lives β€” if the output is being piped, that print statement does not get automatically flushed. so no prompt shows up. and the program just sits there, silently, appearing to hang while it waits for input. it's giving "is it frozen? is it dead? did I break it?" 😭

this might happen with tee, for example:

$ perl guess.pl | tee capture.out

so you use Devel::Autoflush to work around it, periodt:

$ perl -MDevel::Autoflush guess.pl | tee capture.out

or you can set it in PERL5OPT like the queen you are:

$ export PERL5OPT=-MDevel::Autoflush
$ perl guess.pl | tee capture.out

πŸ‘€ SEE ALSO πŸ‘€

  • CPANPLUS::Internals::Utils::Autoflush β€” same idea, honestly same energy, but it's STDOUT only πŸ™ˆ and it's only available as part of the full CPANPLUS distribution, so you can't just grab it solo

🫢 SUPPORT 🫢

πŸ› Bugs / Feature Requests πŸ›

found a bug? want a feature? please report it through the issue tracker at <https://github.com/dagolden/Devel-Autoflush/issues> πŸ’Œ and you'll be notified automatically of any progress on your issue β€” no wondering, no refreshing, she just tells you

πŸ“¦ Source Code πŸ“¦

this is open source software, bestie. the code repository is right there for public review and contribution under the terms of the license:

<https://github.com/dagolden/Devel-Autoflush>

git clone https://github.com/dagolden/Devel-Autoflush.git

πŸ‘‘ AUTHOR πŸ‘‘

David Golden <dagolden@cpan.org> β€” the main character, fr fr

This software is Copyright (c) 2014 by David Golden.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

and that's the whole page, bestie! written for perl v5.36.0, dated 2022-10-13 πŸ’œ go forth and stop your prompts from ghosting you πŸŽ€βœ¨
πŸ“¦ where this page comes from