wrapper for Perl scripts within EMBOSS

Derek Gatherer d.gatherer at vir.gla.ac.uk
Thu Jul 17 12:30:17 UTC 2003


So the following would presumably be the simplest possible wrapper, just 
opening and running a Perl script, using a single line ACD file just to 
name the program and nothing else.  However, the Perl script then needs to 
prompt for any further parameters, infiles etc.  This works, but is it 
against the EMBOSS philosophy?  I did try collecting the Perl parameters 
via the ACD, but didn't manage to figure out a way of easily manipulating 
them into the command line (ie. ajSystemEnv( &cmd, env) ).  I tried things 
like strcat(str1, str 2) and so on, but kept running into type 
incompatibilities with AjPStr.  Is there a standard way to push the usual 
collected strings from the ACD file into a concatenated string that can 
then act as the @ARGV for a Perl script and be called via ajSystemEnv( 
&cmd, env) etc?

#--------------ACD file, hello.acd--------------------------------------#

appl: hello [
         doc: "Calls a Perl script which then does the rest of what you 
want to do"
]

#--------------hello.c wrapper to call hello.pl-----------------------#

#include "emboss.h"

int main(int argc, char **argv, char **env)
{
     AjPStr cmd=NULL;

     char *prog_default = "perl -w path/to/bin/hello.pl";

     embInit("hello",argc,argv);

// invoke the command

     if (!ajNamGetValueC("perl -w path/to/bin/hello.pl", &cmd))
       cmd = ajStrNewC(prog_default);

     ajFmtError( "..%s..\n\n", ajStrStr( cmd));
     ajDebug( "Executing '%S'\n", cmd);
     ajSystemEnv( &cmd, env);

     ajExit();

     return 0;
}




More information about the EMBOSS mailing list