App::I...::Print(3pm)
π App::I...::Print(3pm) β aka App::Info::Handler::Print π
User Contributed Perl Documentation Β· bestie edition πΈ
β¨ NAME β¨
App::Info::Handler::Print β it prints App::Info event messages. That's the whole job. It ate. π
π SYNOPSIS π
use App::Info::Category::FooApp;
use App::Info::Handler::Print;
my $stdout = App::Info::Handler::Print->new( fh => 'stdout' );
my $app = App::Info::Category::FooApp->new( on_info => $stdout );
# Or...
my $app = App::Info::Category::FooApp->new( on_error => 'stderr' );
π¦ DESCRIPTION π¦
okay so. App::Info::Handler::Print objects handle App::Info events by printing their messages to a filehandle. Which means β and this is the slay part β if you want event messages going to a file, or to a system filehandle, this class literally just does that for you. no cap.
but here's the tea β β App::Info::Handler::Print is most effective for info and error events. the unknown and prompt events? those are better handled by event handlers that actually know how to prompt users for data. for an example of that whole situation, go look at App::Info::Handler::Prompt. it's giving β¨built differentβ¨.
when it loads, App::Info::Handler::Print registers itself with App::Info::Handler, setting up a couple of strings that you can pass to an App::Info concrete subclass constructor. these strings are shortcuts that tell App::Info how to create the proper App::Info::Handler::Print object for handling events. the registered strings are, and I cannot stress this enough:
stdoutβ prints event messages toSTDOUT. iconic behavior fr fr.stderrβ prints event messages toSTDERR. also iconic, but angrier π«Ά
and if you wanna know how to make App::Info::Handler::Print print event messages to a different filehandle? check the new() constructor below, bestie. π
π INTERFACE π
πΈ Constructor πΈ
β new
my $stderr_handler = App::Info::Handler::Print->new;
$stderr_handler = App::Info::Handler::Print->new( fh => 'stderr' );
my $stdout_handler = App::Info::Handler::Print->new( fh => 'stdout' );
my $fh = FileHandle->new($file);
my $fh_handler = App::Info::Handler::Print->new( fh => $fh );
constructs a new App::Info::Handler::Print and returns it. main character energy, truly. it can take a single parameterized argument, fh, which can be any one of these values:
stderrβ constructs aApp::Info::Handler::Printobject that prints App::Info event messages toSTDERR. dramatic? maybe. correct? yes. πstdoutβ constructs aApp::Info::Handler::Printobject that prints App::Info event messages toSTDOUT. the classic. the blueprint. πFileHandleGLOBβ pass in a reference andApp::Info::Handler::Printwill assume that it's a filehandle reference that it can print to. heads up though, bestie: pass in something that can't be printed to and it will trigger an exception whenApp::Info::Handler::Printtries to print to it. π that's not a vibe. read your refs carefully.
π¨ if thefhparameter is not passed,new()will default to creating anApp::Info::Handler::Printobject that prints App::Info event messages toSTDOUT. it's defaulting, your honor. β¨
π§ handler
this method is called by App::Info to print out the message from events. that's it. that's the method. short, sweet, does exactly what it says on the tin. π
π«Ά SUPPORT π«Ά
this module is stored in an open GitHub repository β http://github.com/theory/app-info/ β feel free to fork and contribute! the audacity (affectionate) of open source, we love to see it. π
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. don't be shy, the maintainers want to hear from you. π
π AUTHOR π
David E. Wheeler <david@justatheory.com> β the icon, the legend, the one who wrote it. π
π SEE ALSO π
App::Infodocuments the event handling interface. start here, bestie, fr fr.App::Info::Handler::Carphandles events by passing their messages to Carp module functions.App::Info::Handler::Promptoffers event handling more appropriate for unknown and confirm events. (remember the tea from earlier? this is that. π)App::Info::Handlerdescribes how to implement custom App::Info event handlers. build your own, main character. β¨
π 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. slay, legally speaking. β
and that's the whole page, bestie!! πΈπ¦π written for perl v5.36.0, dated 2022-12-06. go forth and print those events. periodt. π β¨
π¦ 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