The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::BeepLite::BaseProfile

SYNOPIS

  $profile = Net::BeepLite::BaseProfile->new();

  my $uri = $profile->uri();

  if ($message->isa('Net::BeepLite::Message') {
    $profile->handle_message($session, $message);
  }

DESCRIPTION

"Net::BeepLite::BaseProfile" is the base class Net::BeepLite profiles should inherit from/implement. It is not intended to be instantiated on its own. This class provides the basic structure of profile.

In general, subclasses only need to override the constructor (for additional initialization parameters, if any) and the various message handler methods (MSG(), RPY(), etc.).

Note that in general BEEP "client" applications generally do not need to create profiles (although they may if they wish). "Server" applications generally do need to create profiles.

Normally profiles are designed to be shared between Sessions. This primarily means that no session or channel base state is stored in the profile object itself. Designers of profiles need not stick to this constraint, however. In this framework, most often each Session is in a different process and thus not actually shared amongst Sessions.

CONSTRUCTOR

new( ARGS )

This constructor currently has no valid arguments.

METHODS

initialize( ARGS )

This method initializes the object. The arguments are named value pairs, although currently none are defined. Users of this class do not call this method, as it is invoked by the constructor. Subclasses, however, should invoke this in their constructors. (i.e., as $self->SUPER::initialize(@_)).

uri([$va])

This returns the profile\'s identifying URI (e.g., http://iana.org/beep/SASL/PLAIN). If passed an optional value, it sets that to the profile's URI.

handle_message($session, $message)

Handle a BEEP message based on its type. This just invokes the profile's various handler functions (MSG(), ERR(), etc.). Returns whatever the handler method returns (generally the original message).

startChannelData($session, $data)

Handle the data the is included in the start channel request. This will be decoded from base64 if necessary. This must return a two element tuple of ($response_data, $encoded), where $encoded is set to true of the data should be base64 encoded. If $response_data is empty, no data will be returned in the profile response.

MSG($session, $message)

Handle MSG type messages. This should be overridden by the subclass. Subclasses should have this method return the original method. This version will simply croak if invoked.

RPY($session, $message)

Handle RPY type messages. This should be overridden by the subclass. Subclasses should have this method return the original method. This version will simply croak if invoked.

ERR($session, $message)

Handle ERR type messages. This should be overridden by the subclass. Subclasses should have this method return the original method. This version will simply croak if invoked.

ANS($session, $message)

Handle ANS type messages. This should be overridden by the subclass. Subclasses should have this method return the original method. This version will simply croak if invoked.

NUL($message)

Handle NUL type messages. This should be overridden by the subclass. Subclasses should have this method return the original method. This version will simply croak if invoked.

SEE ALSO

Net::BeepLite::Message
Net::BeepLite::MgmtProfile