Agent:...r::Fork(3pm)

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

πŸ’– Log::Agent::Driver::Fork πŸ’–

okay bestie, so this is a page from the User Contributed Perl Documentation (that's the 3pm corner of the manual, iykyk), and the module in question is Log::Agent::Driver::Fork β€” literally a dummy driver that forks your output out to multiple other drivers. it's giving multiplexer energy and honestly? obsessed. πŸ¦‹


✨ NAME ✨

Log::Agent::Driver::Fork β€” a dummy driver for forking output to multiple drivers 🌈


πŸŽ€ SYNOPSIS πŸŽ€

no thoughts, just vibes, just this exact code:

use Log::Agent;
require Log::Agent::Driver::Fork;
require Log::Agent::Driver::Foo;
require Log::Agent::Driver::Bar;

my $driver = Log::Agent::Driver::Fork->make(
    Log::Agent::Driver::Foo->make( ... ),
    Log::Agent::Driver::Bar->make( ... )
);
logconfig(-driver => $driver);

πŸ’… DESCRIPTION πŸ’…

this driver is literally just a multiplexer for logxxx() calls β€” it takes them, duplicates them, and distributes copies out to other drivers. like a lil group chat where every message gets forwarded to everyone. πŸ’Œ

the only routine that matters here is the creation routine, and it's a whole main character:

  • make(@drivers) β€” creates a Log::Agent::Driver::Fork driver that duplicates logxxx() calls and hands them out to the drivers in @drivers. 🫢 the arguments must be the return value of the make() call for the client drivers β€” no substitutions, no shortcuts, bestie, that's the rule.

🌸 NOTES 🌸

huge shoutout and many thanks go to Daniel Lundin and Jason May, who proposed this module independently of each other β€” legends, truly. πŸ‘‘

eventually, logconfig() will support multiple drivers directly. but for now, this solution requires no change to the existing interface, which is lowkey the prettiest part about it. ✨


πŸ‘‘ AUTHOR πŸ‘‘

Mark Rogaski <mrogaski@pobox.com> πŸ’œ


πŸ“œ LICENSE πŸ“œ

Copyright (C) 2002 Mark Rogaski; all rights reserved.

see Log::Agent(3) or the README file included with the distribution for license information. fr fr, go read it. πŸ“


πŸ”₯ SEE ALSO πŸ”₯


that's the whole page, bestie β€” slay, you read it all. πŸŽ€ this one shipped as part of perl v5.36.0, dated 2022-10-15, from the User Contributed Perl Documentation (the 3pm section). mwah, go forth and fork responsibly. πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from