App::I...Prompt(3pm)
π NAME π
App::Info::Handler::Prompt β it's the prompting event handler for App::Info, bestie β¨
πΈ SYNOPSIS πΈ
use App::Info::Category::FooApp;
use App::Info::Handler::Print;
my $prompter = App::Info::Handler::Print->new;
my $app = App::Info::Category::FooApp->new( on_unknown => $prompter );
# Or...
my $app = App::Info::Category::FooApp->new( on_confirm => 'prompt' );
π¦ DESCRIPTION π¦
okay so App::Info::Handler::Prompt objects handle App::Info events by printing their messages to STDOUT and then accepting a new value from STDIN. like, it talks to you and then it listens. communication queen π
That new value gets validated by any callback supplied by the App::Info concrete subclass that triggered the event. If the value is valid, App::Info::Handler::Prompt assigns the new value to the event request. If it isn't? It prints the error message associated with the event request, and then prompts for the data again. yes, it will keep asking. it's persistent. it's giving main character energy π
Even though it was designed with unknown and confirm events in mind, App::Info::Handler::Prompt handles info and error events too, no cap. It will simply print info event messages to STDOUT and print error event messages to STDERR. If you want more interesting info and error event handling, go look at App::Info::Handler::Print and App::Info::Handler::Carp. β¨
Upon loading, App::Info::Handler::Print registers itself with App::Info::Handler, setting up a single string, "prompt", that can be passed to an App::Info concrete subclass constructor. This string is a shortcut that tells App::Info how to create an App::Info::Handler::Print object for handling events. iykyk π
π INTERFACE π
π Constructor
β new
my $prompter = App::Info::Handler::Prompt->new;
Constructs a new App::Info::Handler::Prompt object and returns it. No special arguments are required. literally just. new. and it's yours π«Ά
π§ SUPPORT π§
This module is stored in an open GitHub repository <http://github.com/theory/app-info/>. Feel free to fork and contribute! (yes, fork it bestie, the door is open π)
Please file bug reports via GitHub Issues <http://github.com/theory/app-info/issues/> or by sending mail to bug-App-Info@rt.cpan.org <mailto:bug-App-Info@rt.cpan.org>.
π AUTHOR π
David E. Wheeler <david@justatheory.com>
π SEE ALSO π
App::Infodocuments the event handling interface.App::Info::Handler::Carphandles events by passing their messages Carp module functions.App::Info::Handler::Printhandles events by printing their messages to a file handle.App::Info::Handlerdescribes how to implement custom App::Info event handlers.
π COPYRIGHT AND LICENSE π
Copyright (c) 2002-2011, David E. Wheeler. Some Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page, you ate that π this lil doc shipped as part of perl v5.36.0, dated 2022-12-06, and it lives in the User Contributed Perl Documentation corner of the world. go forth and prompt, bestie πβ¨π¦
π¦ where this page comes from
- debian bookworm: libapp-info-perl 0.57-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libapp-info-perl 0.57-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libapp-info-perl 0.57-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libapp-info-perl 0.57-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libapp-info-perl 0.57-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms