The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::BEEP::Lite - Perl framework for BEEP (RFC 3080, 3081).

SYNOPSIS

  use Net::BEEP::Lite qw(beep_connect);
  use Net::BEEP::Lite::ClientSession;

  my $session = beep_connect(Host => localhost,
                             Port => 10288);

  my $channel_num = $session->start_channel
      (URI => 'http://xml.resources.org/profiles/NULL/ECHO');

  my $resp_msg = $session->send_and_recv_message
                   (Content     => "some content",
                    ContentType => 'text/plain');

  print "received response: ", $resp_msg->content(), "\n";

  ---

  use Net::BEEP::Lite::ServerSession;

  my $profile = Net::BEEP::Lite::BaseProfile->new

  beep_listen( Port     => 12345,
               Address  => 127.0.0.1,
               Profiles => [ $profile ],
               Method   => 'fork' );

ABSTRACT

Net::BEEP::Lite is a lightweight implementation of a BEEP client/server framework. This package is intended for implementing fairly simple BEEP clients and servers.

DESCRIPTION

Net::BEEP::Lite is a "lightweight" implementation of a BEEP client/server framework, born out of a desire to have the ability to simple BEEP client and server work without attempting to be the last word on BEEP in Perl.

One thing this package does is intentionally fuse the BEEP Listener role with the Server role, and the Initiatior role with the Client role. That is, it makes no attempt to support the peer-to-peer capabilities of BEEP.

Also, it has only rudimentary support for multiple channels, especially on the server side. In particular, by avoiding the use of threads (or some other complicated forking scheme) it does not handle asynchronous channels. Ultimately, on the server side, messages on different channels are processed serially. This eliminates one of the main purposes of using multiple channels. In fact, the system defaults not allowing clients to open more than one channel at a time.

That being said, it is possible to support multiple channels, but this package is easiest to use when using only one.

EXPORT

beep_listen( ARGS )

This is a main entry function for running a BEEP server. It takes a named arguement list. It supports the following arguments, in addition to the arguments accepted by the Net::BEEP::Lite::ServerSession constructor.:

Port

The TCP port on which to listen.

Address

The address to bind to, if there is more than one interface.

Profiles

This should be an array reference of a list of objects that inherit from Net::BEEP::Lite::BaseProfile (or at least support the same methods). At least one profile MUST be supplied here, or clients will not be able to start any channels.

Method

This is a string describing the multitasking method to use. Currently the only supported option is 'fork'. Future options may be 'prefork' and 'prepostfork'.

Socket

If you wish to use this code but want to setup the socket yourself, you can pass the socket in using this. If you do so, the Port and Address parameters will be ignored.

Debug

If true, this will spew forth (some) stuff to STDERR. It defaults to false.

Trace

If true, this will spew forth even more stuff to STDERR, including the entire conversation.

In general, this function does not return, forming the main event loop of the server.

beep_connect( ARGS )

This is the main entry point for the client. It will either return a Net::BEEP::Lite::ClientSession, already connected to the BEEP peer, or it will return undef and have set Net::BEEP::Lite::errorstr.

It accepts a named parameter list with the following parameters, in addition to the parameters accepted by the Net::BEEP::Lite::ClientSession constructor:

Host

The host to connect to.

Port

The port to connect to.

DEPENDENCIES

This modules depends on:

XML::LibXML

Available on CPAN.

SEE ALSO

RFC 3080
RFC 3081
XML::LibXML

AUTHOR

David Blacka, <davidb@verisignlabs.com>

COPYRIGHT AND LICENSE

Copyright 2003 by Verisign, Inc. Copyright 2003 by David Blacka

This software is licensed under the GNU LGPL. See the file beeplite-license.txt, included in the distribution for the full license.