Log::H...Socket(3pm)
π Log::Handler::Output::Socket β the perl manpage but make it cute
okay bestie, so this page is from the User Contributed Perl Documentation section of the manual, and it's all about Log::Handler::Output::Socket. Consider this your group chat briefing. π«Ά
β¨ NAME β¨
Log::Handler::Output::Socket β literally just: send messages to a socket. that's the whole vibe. π
πΈ SYNOPSIS πΈ
use Log::Handler::Output::Socket;
my $sock = Log::Handler::Output::Socket->new(
peeraddr => "127.0.0.1",
peerport => 44444,
proto => "tcp",
timeout => 10
);
$sock->log(message => $message);
that's it. that's the whole glow-up. β¨
π¦ DESCRIPTION π¦
with this module you can send messages over the network. yes, like, actually over the network. main character networking energy, no cap. π₯
π METHODS π
π§ new()
call new() to create a new Log::Handler::Output::Socket object. it's giving birth but for objects. π
here are all the options you can pass, bestie β don't skip any of them:
peeraddrβ the address of the server. where your message is going, like a little letter. πpeerportβ the port to connect to. the specific door you're knocking on. πͺprotoβ the protocol you wish to use. default is TCP. it's giving classic.timeoutβ the timeout to send a message. default is 5 seconds. don't ghost it for too long or it dips. πpersistentandreconnectβ with this option you can enable or disable a persistent connection, and re-connect if the connection was lost. both options are set to 1 on default, so they're already on. iconic defaults tbh. β¨dumpβ do you like to dump the message? π if you enable this option then all messages will be dumped withData::Dumper. not some. all. periodt.dumperβ do you want to use another dumper instead ofData::Dumper? yes you can, here's an example:
use Convert::Bencode_XS;
dumper => sub { Convert::Bencode_XS::bencode($_[0]) }
# or maybe
use JSON::PC;
dumper => sub { JSON::PC::convert($_[0]) }
connectβ this option is only useful if you want to pass your own arguments toIO::Socket::INETand don't want to usepeeraddrandpeerhost. it's giving DIY. π οΈ
example:
connect => {
PerrAddr => "127.0.0.1",
PeerPort => 44444,
LocalPort => 44445
}
(yes, that's PerrAddr exactly as written, we do not touch the code bestie, copying it character-for-character is the whole assignment π―)
these options are passed to IO::Socket::INET.
π¨ log()
call log() if you want to send a message over the socket. this is the moment. the whole reason we're here. π«
example:
$sock->log("message");
π connect()
connect to the socket. slay, we're online. π
π disconnect()
disconnect from the socket. bye bestie, it was real. π
β
validate()
validate a configuration. making sure everything is correct before we commit β very mature of you. π
π reload()
reload with a new configuration. it's giving rebrand. β¨
π errstr()
this function returns the last error message. so when something goes wrong, ask errstr() what happened. π
π PREREQUISITES π
these need to be in the building for any of this to work:
Carp
Params::Validate;
IO::Socket::INET;
Data::Dumper;
π EXPORTS π
no exports. nothing to export. empty house. π (fr fr, it says "No exports." and it means it.)
π REPORT BUGS π
please report all bugs to <jschulz.cpan(at)bloonix.de>. π«Ά
if you send me a mail then add Log::Handler into the subject. that's the rule, don't forget it. π¬
π AUTHOR π
Jonny Schulz <jschulz.cpan(at)bloonix.de>.
π COPYRIGHT π
Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
just so you know, this page came from theperl v5.36.0docs, dated2022-08-28, in the User Contributed Perl Documentation collection. π
and that's a wrap, bestie β go send some messages over that socket. you got this. π¦β¨π
π¦ where this page comes from
- ubuntu noble: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: liblog-handler-perl 0.90-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: liblog-handler-perl 0.90-2 Β· 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