User Tools

Site Tools


osrf-devel:perl-server-dev

User Comments

OpenSRF Application development Perl API

OpenSRF offers a very simple Application development API to users of the framework. All that is required is to create a Perl module that subclasses the OpenSRF::Application package and register it's methods with the Method Dispatcher framework.

Each method executes in the OpenSRF::Application namespace as an instance of the custom Application. There are some instance methods on this object which can be used by the method to alter the behavior or response that the method sends to the client:

  $self->api_name  # returns the name of the method as called by the client
 
  $self->method    # returns the actual perl name of the sub implementing the
                   # method
 
  my $meth = $self->method_lookup( 'api_name' )
                   # constructs a new instance object implementing another
                   # method in the same Application package as a subrequest
 
  my ($subresult) = $meth->run( @params )
                   # runs the subrequest method and returns the array of
                   # results

All that is required to register an Application with OpenSRF is to place a setting in the configuration file that names the module that implements the new Application, and to add the new Application's symbolic name to the list of servers that should be started by OpenSRF. See Appendix A for more information on the central config file.

See here for a simple example server.

osrf-devel/perl-server-dev.txt · Last modified: 2007/03/20 00:29 by miker

© 2008-2017 GPLS and others. Evergreen is open source software, freely licensed under GNU GPLv2 or later.
The Evergreen Project is a member of Software Freedom Conservancy.