NAME
Remind::Client - class for working with remind's daemon mode
SYNOPSIS
package Remind::Client::something;
use base 'Remind::Client';
sub reminder {
my ($self, %args) = @_;
say "Got the message: $args{message}";
}
package main;
my $rc = Remind::Client::something->new();
$rc->run();
DESCRIPTION
This module provides methods for communicating with the "Server Mode" of remind. It
METHODS
new
Construct a new Remind::Client object. Takes the following named parameters:
- filename
-
The filename of the reminders file to use. Defaults to $ENV{DOTREMINDERS}, if it exists, or ~/.reminders.
run
Start up an instance of remind in server mode, and begin to listen for events.
reminder
This handler is fired whenever a reminder is sent from remind. So, for a timed reminder like:
REM 01 Oct 2009 AT 10:50 +10 *5 MSG It's time%
This would be fired at 10:40, 10:45, and 10:50.
It receives the following named parameters:
- message
-
The reminder message; chomped. In the above example, it would be "It's time".
- due_time
-
The time this reminder is set for. In the above example, it would always be '10:50am'.
- reminder_time
-
The time this reminder fired. In the above example, it would be '10:40am', '10:45am', and '10:50am'.
- tag
-
The TAG from the reminder. If there is no TAG, then it defaults to '*'.
The default implementation does nothing; most subclasses of Remind::Client will want to implement this.
newdate
This is fired when the day changes over. Use it to do things like check for new daily reminders.
This receives no parameters.
The default implementation does nothing.
reread
This is fired when the number of reminders in the queue changes because the day has changed, or because of a REREAD command. The recommendation is to issue a 'STATUS' command in response to this.
This receives no parameters.
The default implementation does nothing.
queued
This is fired as a result of a STATUS command. It receives the following named parameters:
- count
-
The number of reminders that are queued.
The default implementation does nothing.
send
Send a command to the remind server.
Takes one named parameter, command
. It may be one of:
- EXIT
-
Tell the remind server to exit. This will also finish the current run().
- STATUS
-
Request the current number of queued reminders from the server. This will result in a queued() event being fired.
- REREAD
-
Request that the server reread the configuration. This will result in a reread() event being fired.
on_connect
This is fired once, after $rc->run() has started up the remind server. It is useful for checking for things like daily reminders, etc.
It receives no parameters.
The default implementation does nothing.
sigHUP
Default SIGHUP handler. Sends a REREAD command to the server.
BUGS
This doesn't provide any useful support for non-timed reminders (yet).
SEE ALSO
"SERVER MODE" in tkremind(1), remind(1)
Remind::Parser for a tool to parse the calendar output.
Remind's Homepage: http://www.roaringpenguin.com/products/remind
AUTHOR
Mike Kelly <pioto@pioto.org>
COPYRIGHT AND LICENSE
Copyright (C) 2009, Mike Kelly.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses at <http://www.perlfoundation.org/artistic_license_1_0>, and <http://www.gnu.org/licenses/gpl-2.0.html>.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.