Net::Chat::Daemon

Net::Chat::Daemon is a Perl module to run a daemon that is controlled via instant messaging.
Download

Net::Chat::Daemon Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Steve Fink
  • Publisher web site:
  • http://search.cpan.org/~sfink/IPC-Run-Simple-1.3/lib/IPC/Run/Simple.pm

Net::Chat::Daemon Tags


Net::Chat::Daemon Description

Net::Chat::Daemon is a Perl module to run a daemon that is controlled via instant messaging. Net::Chat::Daemon is a Perl module to run a daemon that is controlled via instant messaging.ABSTRACTThis package is intended to serve as a superclass for objects that want to communicate via IM messages within a distributed network of client nodes and a coordinator, without dealing with the complexities or implementation details of actually getting the messages from place to place.It pretends to be protocol-neutral, but for now and the conceivable future will only work with a Jabber transport. (It directly uses the message objects and things that Jabber returns.)Note that this package will NOT help you implement an instant messaging server. This package is for writing servers that communicate with other entities via instant messages -- servers written using this package are instant messaging *clients*.SYNOPSIS package My::Server; use base 'Net::Chat::Daemon'; sub handleHello { return "hello to you too"; } sub handleSave { my ($filename, $file) = @_; return "denied" unless $filename =~ /^+$/; open(my $fh, ">/var/repository/$filename") or return "failed: $!"; print $fh $file; close $fh or return "failed: $!"; return "ok"; } sub someMethod { my ($self, @args) = @_; . . . } sub new { my ($class, $user, %options) = @_; return $class->SUPER::new(%options, commands => { 'callMethod' => 'someMethod', 'save' => &handleSave }); } package main; my $server = My::Server->new('myuserid@jabber.org'); $server->process(); # or to do it all in one step, and retry connections for 5 minutes # (300 seconds) before failing due to problems reaching the server: My::Server->run('myuserid@jabber.org', retry => 300);When you run this, you should be able to send a message to userid@jabber.org saying "hello" and get a response back, or "callMethod a b c" to call the method with the given arguments.To use the "save" command, you'll need to use a command-line client capable of sending attachments in the format expected by this server (it currently does not use any standard file-sending formats).The jabber command packaged with this module can do this via the -a command-line option.A note on the implementation: when I first wrote this, it was really only intended to be used with Jabber. The code hasn't been fully restructured to remove this assumption.Requirements:· Perl Requirements: · Perl


Net::Chat::Daemon Related Software