13 Jun 2022 12:09:39 UTC
- Distribution: Net-Clacks
- Module version: 24
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (1)
- Testers (304 / 0 / 21)
- KwaliteeBus factor: 1
- 10.90% Coverage
- License: unknown
- Activity24 month
- Download (56.18KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest version
- IMPORTANT NOTE
- COPYRIGHT AND LICENSE
Net::Clacks::Client - client for CLACKS interprocess messaging
This implements the client network protocol for the CLACKS interprocess messaging. This is used a lot in PageCamel projects to let different processes (workers, webgui, PageCamelSVC) communicate with each other
Create a new instance.
Create a new instance, but use a Unix domain socket instead of tcp/ip
Reconnect to the CLACKS server when something went wrong.
Returns the raw socket. You MUST NOT send or read data from because this will mess up the connection. Access to the raw socket is only useful in speciality cases, like you want to wait on multiple Clacks sockets for incoming data using IO::Select. In most cases, you wont need this.
Process incoming and outpoing messages. doNetwork tries to send as much as possible. But due to network congestion it might not be able to send everything in one go and it will try not to hold up the caller for too long. Thats why it's important to call doNetwork from the cyclic loop of your programm at least every few seconds or so (depending on what you are trying to do).
doNetwork takes one optional argument, the timeout time to wait for incoming traffic. The default is not to wait at all.
Send everything in the client out queue to the server and wait for a confirmation from the server it has recieved everything. This is a syncronous operation and will hold up the calling program.
Send a PING (keepalive) packet.
Temporarly disable auto-disconnects by the server (NOPING command). Useful before doing something with indeterminate length (long running functions and such).
NOTIFY other clients via CLACKS that an event happened.
SET a value for a CLACKS variable to other clients.
LISTEN to specific NOTIFY and SET events.
Stop listening to specific NOTIFY and SET events.
STORE a value in clacks for later retrieval.
RETRIEVE a values from clacks that has been stored earlier.
INCREMENT a stored value by one. Takes an optional argument to say how much to increment.
DECREMENT a stored value by one. Takes an optional argument to say how much to decrement.
REMOVE/DELETE a stored key from clacks
Get a list of all keys stored in clacks.
Remove all keys stored in clacks.
Meta-function that both calls set() and store() internally with a single library call. Useful in some circumstances when you both want to remember the variable and also tell everyone interested immediately that it has changed.
Enable/Disable monitor mode. When enabled, the server sends all events it sees as DEBUG events (events LISTENed to also get send the normal way).
Get server name and version.
Get the next incoming event in the queue.
Get a list of all clients connected to the server. If the server is using interclacks (multiple servers in a pool), it will only list the clients connected to the server you are connected to.
Adds whatever you want to the out queue, to be send to the server. This is mostly useful when debugging and/or enhancing your server or if you want to implement a command line shell to your clacks server-
This activates a sort of memcached compatibility setup. Don't use this directly, it's an internal wonky workaround. Use Net::Clacks::ClacksCache instead.
This is also part of the internal memcached compatibility setup. Don't use this directly.
Tries to send all remaining data in the output buffers and then disconnect cleanly from the server. Of course, if the connection already has gone the way of the dodo, any chance of cleanly disconnecting has already passed.
This tries to close the connection cleanly but there is a good chance it wont succeed under certain circumstances, especially on program exit. Use disconnect() before exiting your program for a better controlled behaviour.
Please make sure and read the documentations for Net::Clacks as it contains important information pertaining to upgrades and general changes!
Rene Schickbauer, <firstname.lastname@example.org>
Copyright (C) 2008-2022 Rene Schickbauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.