IO::Prompt::Tiny(3pm)
π IO::Prompt::Tiny β bestie edition π
okay so this page is IO::Prompt::Tiny(3pm) from the User Contributed Perl Documentation, and honestly? it's the little module that could. tiny name, tiny job, zero drama. let's get into it π«Ά
β¨ NAME β¨
IO::Prompt::Tiny β prompt ur user for input, but with a default option so nobody's left hanging π
πΈ VERSION πΈ
version 0.003 β she's small, she's stable, she's iconic
π SYNOPSIS π
use IO::Prompt::Tiny qw/prompt/;
my $answer = prompt("Yes or no? (y/n)", "n");
that's it. that's the whole vibe. import prompt, call prompt, get an answer. periodt β¨
π¦ DESCRIPTION π¦
so this is an extremely simple prompting module. like, extremely extremely. it's based on the extremely simple prompt that ExtUtils::MakeMaker offers, and here's the tea: in sooo many cases, that's literally all you need. this module hands it to you without dragging in all the overhead of ExtUtils::MakeMaker just to ask one lil question. not me avoiding an entire build system for a y/n prompt π iconic behavior fr fr
it does not do validation. no coloring. no menus. no timeouts. none of the wild, crazy, cool stuff other prompting modules get up to. it just prompts with a default. that's it! π
π USAGE π
the following function may be explicitly imported. no functions are imported by default β so yes bestie, you gotta ask for it by name π
prompt
my $value = prompt($message);
my $value = prompt($message, $default);
the prompt() function displays the message as a prompt for input, then returns the (chomped) response from the user β or the default, if the response came back empty. no trailing newline nonsense, she chomps. π
if the program is not running interactively, or if the PERL_MM_USE_DEFAULT environment variable is set to true, the default gets used without prompting at all. so in CI, nobody's sitting there staring at a cursor like ποΈπποΈ
if no default is provided, an empty string is used instead. simple as that.
and here's a lil glow-up moment: unlike ExtUtils::MakeMaker::prompt(), this prompt() does not use prototypes, so this works as expected:
my @args = ($prompt, $default);
prompt(@args);
no prototype jumpscare. we love to see it π₯
π ENVIRONMENT π
PERL_MM_USE_DEFAULT
if this is set to a true value, IO::Prompt::Tiny will always return the default without waiting for user input β just like ExtUtils::MakeMaker does. set it and forget it, bestie π
π ACKNOWLEDGMENTS π
the guts of this module are based on ExtUtils::MakeMaker and IO::Interactive::Tiny (which is itself based on IO::Interactive). thank you to the authors of those modules β they really carried the squad here π«Ά
π SEE ALSO π
IO::PromptIO::Prompt::SimplePrompt::TimeoutTerm::Prompt
all the cousins at the family reunion π
π§ SUPPORT π§
Bugs / Feature Requests
please report any bugs or feature requests through the issue tracker at <https://github.com/dagolden/IO-Prompt-Tiny/issues>. you will be notified automatically of any progress on your issue β so you're never left on read, fr fr π¬
Source Code
this is open source software. the code repository is available for public review and contribution under the terms of the license.
<https://github.com/dagolden/IO-Prompt-Tiny>
git clone https://github.com/dagolden/IO-Prompt-Tiny.git
go clone her, she's waiting π¦
β AUTHOR β
David Golden <dagolden@cpan.org> β king behavior, no cap π
π COPYRIGHT AND LICENSE π
this software is Copyright (c) 2012 by David Golden.
this is free software, licensed under:
The Apache License, Version 2.0, January 2004
lowkey a whole legal situation but make it slay. respect the license bestie, it's the rules π
π sign-off π
and that's the whole page!! she's perl v5.36.0, dated 2022-10-13, and lives her life as IO::Prompt::Tiny(3pm) in the User Contributed Perl Documentation. go prompt somebody. with a default. as a treat. πβ¨πΈπ¦π
π¦ where this page comes from
- ubuntu noble: libio-prompt-tiny-perl 0.003-3 Β· Apache-2.0
- ubuntu resolute: libio-prompt-tiny-perl 0.003-3 Β· Apache-2.0
- ubuntu stonking: libio-prompt-tiny-perl 0.003-3 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms