Skip to end of metadata
Go to start of metadata

How do you implement Jobs with Perl?

Question:

Where can I get the Perl libraries for the Job Schedule API? There is a package main, do I get that with JobScheduler download or do I have to go to CPAN?

Answer:

It depends on the operating system:

  • for Windows we do not distribute a library but use the scripting libraries from an existing ActiveState Perl implementation, see http://www.activestate.com.
  • for Unix the library libsosperlscript.so should have been copied to the lib directory by the installer. Moreover the libperl.so 32Bit library from your Perl installation must be linked in the lib directory.

    Example:

      cd /[JobScheduler installation]/lib/
      ln -s /usr/lib/perl5/5.10.0/i386-linux-thread-multi/CORE/libperl.so libperl.so
    

Keep in mind that:

  • you could use <job><process file="my_script.pl"/></job> to use Perl as from the command line (my_script.pl must be executable). This works with all versions of Perl, but no API methods of JobScheduler can be used.
  • you would use <job><script language="perlscript"><include file="my_api_script.pl"/></job> for a Perl script that makes use of JobScheduler API and requires the above libraries for Unix.

The API documentation is available:

There is no such thing as a JobScheduler package for Perl as JobScheduler exposes its objects and methods directly, just use

  # to make the object variables available ...
  use vars qw ($spooler $spooler_log $spooler_job $spooler_task);
  # ... then use the objects and methods, e.g to access a job parameter
  $spooler_task->params->value("request_stylesheet")

Some more complete examples of Perl jobs are given in the Solutions Pages of this site, see:

The given examples are mainly interesting as we provided job implementations for Perl, Java and Javascript: even if you do not intend to implement Web Services the source code and job documentations are useful to see how the API works equally for all languages.

Write a comment…