IM::Engine - The HTTP::Engine of instant messaging
IM::Engine->new( interface => { protocol => 'AIM', credentials => { screenname => '...', password => '...', }, incoming_callback => sub { my $incoming = shift; my $message = $incoming->plaintext; $message =~ tr[a-zA-Z][n-za-mN-ZA-M]; return $incoming->reply($message); }, }, )->run;
IM::Engine abstracts away the details of talking through different IM services. A Jabber bot will be essentially the same as an AIM bot, so IM::Engine facilitates switching between these different services.
It is currently alpha quality with serious features missing and is rife with horrible bugs. I'm releasing it under the "release early, release often" doctrine. Backwards compatibility may be broken in subsequent releases.
In particular, I am likely to move IM::Engine::Interface::AIM, IM::Engine::Interface::Jabber, and IM::Engine::Interface::IRC into their own distributions, since they have their own dependencies.
IM::Engine currently understands the following protocols:
Talks AIM using Net::OSCAR:
IM::Engine->new( interface => { protocol => 'AIM', credentials => { screenname => 'foo', password => '...', }, }, # ... );
Talks XMPP using AnyEvent::XMPP:
IM::Engine->new( interface => { protocol => 'Jabber', credentials => { jid => 'foo@gchat.com', password => '...', }, }, # ... );
Talks IRC using AnyEvent::IRC:
IM::Engine->new( interface => { protocol => 'IRC', credentials => { server => "irc.perl.org", port => 6667, channels => ["#moose", "#im-engine"], nick => "Boot", }, }, # ... );
There has been some concern about whether IRC is actually an IM protocol. I certainly consider private messages to be IM-ish. For some bots, joining regular human-infested channels would also make sense. Bots that just respond to chatters (which is most, if not all, of what purl does) make sense outside of the context of IRC, so that is the use case I am targetting.
Opens up a shell where every line of input is an IM. Responses will be printed to standard output. Handy for testing.
IM::Engine->new( interface => { protocol => 'REPL', }, # ... );
Pass your IM as command-line arguments. Your response will be printed to standard output. Handy for testing but could also be distributed as a useful script (I want this for Hiveminder's IM interface :))
:)
IM::Engine->new( interface => { protocol => 'CLI', }, # ... );
Shawn M Moore, sartak@gmail.com
sartak@gmail.com
The inspiration for the initial design
Uses Path::Dispatcher to provide sugary IM dispatch
Provides state management methods on IM::Engine::Users
Allows multiple commands to be run in one IM (builds on IM::Engine::Plugin::Dispatcher)
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, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IM::Engine
CPAN shell
perl -MCPAN -e shell install IM::Engine
For more information on module installation, please visit the detailed CPAN module installation guide.