memo.xight.org

日々のメモ

Perl で MSN Messenger

MSN.pm

  MSN MessengerをPerlから操作するためのモジュール
  Bot-Depot - MSN Protocol modules - MSN.pm
  http://www.bot-depot.com/forums/?showforum=12
#!/usr/bin/perl

use MSN;
use Jcode;

my $msn = MSN->new(Handle => 'hoge@hotmail.com', Password => 'hogepass');
$msn->set_handler(Message   => \&on_message);
$msn->connect();

while(1) {
	$msn->do_one_loop();
}

sub on_message {
	my ($self, $email, $name, $msg) = @_;
	my $utf8_name = Jcode->new($name, 'utf8')->euc;
	my $str = Jcode->new($msg, 'utf8')->euc;

	# $str を処理...

	my $utf8_str = Jcode->new($str, 'euc')->utf8;
	$self->sendmsg($utf8_str);
}


Net::Msmgr

Net-Msmgr
  http://search.cpan.org/~slstat/Net-Msmgr/
  - Install

# perl -MCPAN -e 'install Net::Msmgr'


Net::MSN

Net-MSN
  http://search.cpan.org/~djr/Net-MSN/
  - Install

# perl -MCPAN -e 'install Hash::Merge'
# perl -MCPAN -e 'install Net::MSN'


Reference

  Bot-Depot
  http://www.bot-depot.com/
  cubic9.com - Linux/Perl/MSN.pm
  http://cubic9.com/Devel/Perl/MSN.pm%20%28Bot-Depot%20realesed%29/