1Log::Handler::Output::SUoscekretC(o3n)tributed Perl DocuLmoegn:t:aHtainodnler::Output::Socket(3)
2
3
4

NAME

6       Log::Handler::Output::Socket - Send messages to a socket.
7

SYNOPSIS

9           use Log::Handler::Output::Socket;
10
11           my $sock = Log::Handler::Output::Socket->new(
12               peeraddr    => "127.0.0.1",
13               peerport    => 44444,
14               proto       => "tcp",
15               timeout     => 10
16           );
17
18           $sock->log(message => $message);
19

DESCRIPTION

21       With this module it's possible to send messages over the network.
22

METHODS

24   new()
25       Call "new()" to create a new Log::Handler::Output::Socket object.
26
27       The following options are possible:
28
29       peeraddr
30           The address of the server.
31
32       peerport
33           The port to connect to.
34
35       proto
36           The protocol you wish to use. Default is TCP.
37
38       timeout
39           The timeout to send message. The default is 5 seconds.
40
41       persistent and reconnect
42           With this option you can enable or disable a persistent connection
43           and re-connect if the connection was lost.
44
45           Both options are set to 1 on default.
46
47       dump
48           Do you like to dump the message? If you enable this option then all
49           messages will be dumped with "Data::Dumper".
50
51       dumper
52           Do you want to use another dumper as "Data::Dumper"? You can do the
53           following as example:
54
55               use Convert::Bencode_XS;
56
57                   dumper => sub { Convert::Bencode_XS::bencode($_[0]) }
58
59               # or maybe
60
61               use JSON::PC;
62
63                   dumper => sub { JSON::PC::convert($_[0]) }
64
65       connect
66           This option is only useful if you want to pass your own arguments
67           to "IO::Socket::INET" and don't want use "peeraddr" and "peerhost".
68
69           Example:
70
71                   connect => {
72                       PerrAddr  => "127.0.0.1",
73                       PeerPort  => 44444,
74                       LocalPort => 44445
75                   }
76
77           This options are passed to "IO::Socket::INET".
78
79   log()
80       Call "log()" if you want to send a message over the socket.
81
82       Example:
83
84           $sock->log("message");
85
86   connect()
87       Connect to the socket.
88
89   disconnect()
90       Disconnect from socket.
91
92   validate()
93       Validate a configuration.
94
95   reload()
96       Reload with a new configuration.
97
98   errstr()
99       This function returns the last error message.
100

PREREQUISITES

102           Carp
103           Params::Validate;
104           IO::Socket::INET;
105           Data::Dumper;
106

EXPORTS

108       No exports.
109

REPORT BUGS

111       Please report all bugs to <jschulz.cpan(at)bloonix.de>.
112
113       If you send me a mail then add Log::Handler into the subject.
114

AUTHOR

116       Jonny Schulz <jschulz.cpan(at)bloonix.de>.
117
119       Copyright (C) 2007-2009 by Jonny Schulz. All rights reserved.
120
121       This program is free software; you can redistribute it and/or modify it
122       under the same terms as Perl itself.
123
124
125
126perl v5.34.0                      2021-07-22   Log::Handler::Output::Socket(3)
Impressum