Net::Async::Matrix - use Matrix with IO::Async
Net::Async::Matrix
TODO
This module allows an program to interact with a Matrix homeserver as a connected user client.
The following events are invoked, either using subclass methods or CODE references in parameters:
CODE
A request to write a debugging log message. This is provided temporarily for development and debugging purposes, but will at some point be removed when the code has reached a certain level of stability.
Invoked on receipt of a user presence change event from the homeserver. %changes will map user state field names to 2-element ARRAY references, each containing the old and new values of that field.
%changes
Invoked when a new room becomes known about (because of the initial IMSync or on receipt of a room invite), or when the user has now left a room. Each is passed an instance of Net::Async::Matrix::Room.
Net::Async::Matrix::Room
The following named parameters may be passed to new or configure. In addition, CODE references for event handlers using the event names listed above can also be given.
new
configure
Optional login details to use for logging in as an existing user if an access token is already known. For registering a new user, see instead the register method.
register
Hostname and port number to contact the homeserver at. Given in the form
$hostname:$port
This string will be interpolated directly into HTTP request URLs.
The following methods documented with a trailing call to ->get return Future instances.
->get
Performs the initial IMSync on the server, and starts the event stream to begin receiving events.
While this method does return a Future it is not required that the caller keep track of this; the object itself will store it. It will complete when the initial IMSync has fininshed, and the event stream has started.
Future
Stops the event stream. After calling this you will need to use start again to continue receiving events.
start
Returns the user object representing the connected user.
Sends a user account registration request to the Matrix homeserver to create a new account. On successful completion, the returned user ID and token are stored by the object itself and the event stream is started.
Accessor and mutator for the user account's "display name" profile field.
Accessor and mutator for the user's current presence state and optional status message string.
Requests the creation of a new room with the given alias name.
Requests to join an existing room with the given alias name.
Performs an IMSync operation, fetching the set of rooms the user is a member of, their current state, and an optional snapshot of the latest messages there.
Takes the following named arguments:
Optional number of messages per room to return. Defaults to zero; fetching only the list of rooms and their state, without any message snapshots.
Paul Evans <leonerd@leonerd.org.uk>
To install Net::Async::Matrix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Async::Matrix
CPAN shell
perl -MCPAN -e shell install Net::Async::Matrix
For more information on module installation, please visit the detailed CPAN module installation guide.