IM::Engine::Plugin::State - Keep track of some state for each user
IM::Engine->new( interface => { ... incoming_callback => sub { my $incoming = shift; my $user = $incoming->sender; my $last_time = $user->get_state('last_time'); my $now = time; $user->set_state(last_time => $now); if ($last_time) { return $incoming->reply("You last IMed me " . ($now - $last_time) . "s ago."); } else { return $incoming->reply("Hi, IM me again!"); } }, }, plugins => ['State::InMemory'], )->run;
This module lets you store some state for each user. Right now the only backend is IM::Engine::Plugin::State::InMemory which seriously limits usability. But more will come. I just want something with a useful API that I can continue to build up.
Shawn M Moore, sartak@gmail.com
sartak@gmail.com
Copyright 2009 Shawn M Moore.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install IM::Engine::Plugin::State, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IM::Engine::Plugin::State
CPAN shell
perl -MCPAN -e shell install IM::Engine::Plugin::State
For more information on module installation, please visit the detailed CPAN module installation guide.