Perl MoSeS: Generate & Edit Code

This panel is a user-interface to the Perl MoSeS sub-project. MoSeS stands for Moby Services Support and its documentation is available at:
http://search.cpan.org/dist/MOSES-MOBY/lib/MOSES/MOBY.pm

In order to use this panel, you will have to ensure that you (or your sys admin) have installed Perl and the CPAN module MOSES::MOBY (http://search.cpan.org/dist/MOSES-MOBY/). Once that module has been installed and you have performed the user configuration step (moses-install.pl), you will be able use this panel!

Once again, this panel is only useful in those situations that you have installed the CPAN module 'MOSES::MOBY' and have run the user configuration script 'moses-install.pl'!

The panel has two different parts - one generates code for the selected services, and one provides you with an editor to aid in writing the business logic for any service that you generate with this Perl-MoSeS.

For both parts, you need to start by selecting a service, services, or authority in the services tree. Multiple selection is possible usingSHIFT or CONTROL. If you select an authority, all services from this authority are considered selected.

All activities are done in the background using the command line utilities installed by the Perl-MoSeS module.

 

Perl-MoSeS sub panel

The Perl-MoSeS sub panel allows you to:

* when the panel is created, it makes a best attempt to determine whether or not the cpan module MOSES-MOBY was installed as root. If it was not, this sub panel is visible.

Possible caveats:

Generate

There is one generator in this panel for creating services, with a couple of options.

Once you have chosen your desired options, you can click on the Generate Skeletons button. This will go through and generate perl modules that represent the services that you selected in the 'Service Browser'.

All files are generated into your local Perl-MoSeS/ installation. For instance, assuming that your username is moby_user and that your home directory is /home/moby_user/, then you could find your service skeletons in /home/moby_user/Perl-MoSeS/services/Service/ directory.

When you generate CGI based moby services, an additional file is generated into /Perl-MoSeS/cgi/. In order to implement the business logic, only the skeletons mentioned above are required. The files in the cgi/ directory are only used for deploying your services.

Local User Config

The configuration sub panel allows you to specify:

Once this information is entered, and the 'Confirm values are correct' is clicked, we check whether the required MOSES scripts are accessible. If everything is deemed to be fine, the other sub panels are enabled. Otherwise, you will be prompted to check your values.

Help on setting your local user configuration

Some users find this information hard to obtain. One trick that I use, is to enter 'perl -V' at the command prompt. Among other things, one of the last things that you will see displayed is something like:

Built under linux
Compiled at Nov 27 2007 10:44:36
@INC:
/etc/perl
/usr/local/lib/perl/5.8.8
/usr/local/share/perl/5.8.8
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8
/usr/share/perl/5.8
/usr/local/lib/site_perl
.

Keeping the above in mind and remembering that when you installed (locally for just you and not system wide!) MOSES-MOBY from the command prompt, you specified a PREFIX=/some/path/, similar to the following:

   perl Makefile.PL PREFIX=/home/ekawas/usr/local

The values that you would then enter for PERL5LIB are:

In other words, you are interested in using the PREFIX /lib/ directories.

The value that you should set for the 'MoSeS Scripts Directory' are usually located in the PREFIX/bin/ directory.

 

Perl-MoSeS: Editor sub panel

This sub panel consists of an editor pane with various tools that will allow you to open and edit perl scripts generated by Perl-MoSeS. One of the nicer features of this editor, is the syntax highlighing that it performs on perl scripts.

Editor

The editor allows you to open and easily edit perl scripts that you generate with MoSeS.

The editor has a really simple interface:

There are also a two buttons for enlarging or shrinking the text in the editor. All of these buttons are located on a toolbar that you can detach from the panel.

 

Service deployment

Once you have created your service, you will want to deploy it. Depending on whether you have generated a SOAP service or a CGI based service, the steps to involved to deploy your service.

Deploying a SOAP Service

Deploying a SOAP based service is both easy and straightforward. Best of all, you only need to worry about deploying your service once (all subsequent services that you generate dont require you to do anything!). The reason for this is that SOAP based services utilize a dispatcher file that maps client requests to an appropriate Perl module. Perl-MoSeS only requires you to place a symbolic link to this dispatcher in your web servers cgi-bin directory. Once this is complete, Perl-MoSeS takes care of the rest each and every time you generate new services.

An example of how to deploy your service is shown below. The example assumes that your username is moby_user, that your home directory is /home/moby_user/ and that your cgi-bin directory is located at /usr/lib/cgi-bin.

   cd /usr/lib/cgi-bin
   sudo ln -s /home/moby_user/Perl-MoSeS/MobyServer.cgi .

Please make sure that the complete path the /home/moby_user/Perl-MoSeS is readable by your web server's process.

That is all there is to it. Now you can use Dashboard's Simple Client panel to test your service!

Deploying an ASYNC SOAP Service

Deploying asynchronous SOAP based service is also easy and straightforward. Best of all, you only need to worry about deploying your service once (all subsequent services that you generate dont require you to do anything!). The reason for this is that SOAP based services utilize a dispatcher file that maps client requests to an appropriate Perl module. Perl-MoSeS only requires you to place a symbolic link to this dispatcher in your web servers cgi-bin directory. Once this is complete, Perl-MoSeS takes care of the rest each and every time you generate new services.

An example of how to deploy your service is shown below. The example assumes that your username is moby_user, that your home directory is /home/moby_user/ and that your cgi-bin directory is located at /usr/lib/cgi-bin.

   cd /usr/lib/cgi-bin
   sudo ln -s /home/moby_user/Perl-MoSeS/AsyncMobyServer.cgi .

Please make sure that the complete path the /home/moby_user/Perl-MoSeS is readable by your web server's process.

That is all there is to it. Now you can use Dashboard's Simple Client panel to test your service!

Deploying a CGI Service

Deploying a CGI based service is a lot like deploying a SOAP based one. Unfortunately, every CGI based service that you generate requires you to deploy it onto your web server. This is in constrast to the SOAP services mentioned above.

When you generate CGI services, Perl-MoSeS generates 2 files. Your implementation file and a cgi script to be placed on your web server. Perl-MoSeS only requires you to place a symbolic link to this cgi script in your web servers cgi-bin directory.

You might ask, where is this cgi script? All cgi scripts generated by Perl-MoSeS are placed in the Perl-MoSeS/cgi/ directory.

An example of how to deploy your CGI service is shown below. The example assumes that your username is moby_user, that your home directory is /home/moby_user/ and that your cgi-bin directory is located at /usr/lib/cgi-bin. Moreover, we will be deploying the CGI service HelloBiomobyWorld that is provided by samples.jmoby.net.

   cd /usr/lib/cgi-bin
   sudo ln -s /home/moby_user/Perl-MoSeS/cgi/samples/jmoby/net/HelloBiomobyWorld.cgi .

Please make sure that the complete path the /home/moby_user/Perl-MoSeS is readable by your web server's process.

That is all there is to it. Now you can use Dashboard's Simple Client panel to test your service!