Script for job submission

Hi,
I wondered whether anyone could point me in the direction of documentation for MaterialsScript. I'm hoping to extend the exsting CASTEP calculation functionality to allow jobs to be run on Grid resources using a web service based submission node but I don't seem to be able to find information on the Perl API to see whether this is possible.
Many thanks in advance,
Daniel.