GSM::SMS::TransportRouter::TransportRouter - Abstract router class


GSM-SMS documentation Contained in the GSM-SMS distribution.

Index


Code Index:

NAME

Top

GSM::SMS::TransportRouter::TransportRouter - Abstract router class

DESCRIPTION

Top

An abstract TransportRouter base class. All concrete transport routers must inherit from this class.

METHODS

Top

new - constructor
route - the actual router method
  $route = $tr->route( $msisdn, @transport_list );

  Return 'undef' when no route found.

  ABSTRACT METHOD - needs to be implemented.

get_transport

When an explicit transport has been given to the constructor, we'll only try to route through this transport. This method can be used to get the name of that specific transport.

AUTHOR

Top

Johan Van den Brande <johan@vandenbrande.com>


GSM-SMS documentation Contained in the GSM-SMS distribution.
package GSM::SMS::TransportRouter::TransportRouter;
use strict;
use vars qw( $VERSION );

use Log::Agent;

sub new {
	my ( $proto, %arg ) = @_;
	my $class = ref($proto) || $proto;

	logdbg "debug", "$class constructor called";

	bless { _transport => $arg{-transport} }, ref($proto) || $proto;
}

sub route {
	my ($self) = @_;

	my $object_class = ref($self);
	my ($file, $line, $method) = (caller(1))[1..3];
	die "Call to abstract method ${method} at $file, line $line\n";
}	

sub get_transport { return $_[0]->{_transport}; }


1;

__END__