Re: [Soaplab2-dev] ACD outfile problem: how do you return a file?
Brought to you by:
marsenger
From: Martin S. <mar...@gm...> - 2008-09-09 18:29:04
|
> Ah...is there any way I can get around this? I have an application that > output nine different text files, all with hard-coded names! > > > You have to wrap you script into few lines that can > > map the hard-coded file name into the one given by Soaplab (in your > exanple, > > it was: > > > /home/tc/apache-tomcat-6.0.16/temp/_R_/SANDBOX/[text_to_speech.freetts]_4ca7ea84.11b07436c4e._7ffe/o_output). > > But won't this change every time? Yes, the file name will be different each time, but the parameter name not. What I meant was this: Because your application produces 9 output files, you have to define nine outputs in the ACD file. To each of them, you create a parameter name - any name of your choice; for example: out1, out2, ...out9. Then you write a wrapper that explores the command line create by Soaplab and convert it into your nine hard coded names. For example, Soaplab will produce a command-line like this: wrapper -out1 /home/tc/apache-tomcat..../o_output -out2 /home/tc/.... -out3 blah/blah... and the task of your wrapper is to take the value of the parameter '-out1' (which is /home/tc/apache-tomcat..../o_output) and convert it into a single name that your application expects. And so on, for all -outX parameters. For example, a wrapper in Perl may be like this (just for three hard coded outputs; replace 'echo' by the name of your real program): #!/usr/bin/perl -w # use Getopt::Long; my ($hard1, $hard2, $hard3); GetOptions ("out1=s" => \$hard1, "out2=s" => \$hard2, "out3=s" => \$hard3); exec ('echo', $hard1, $hard2, $hard3); This wrapper changes this input arguments: --out1 value1 --out2 value2 --out3 valu3 into this: value1 value2 value3 A site comment: In order to let Soapab generates a command-line with the 'long' options - the ones started with double dashes, you use in the ACD file the 'option: method', For example: outfile : out1 [ option: "method --&& $$" ... ] But this was just because my example wrapper is using the long options. You can also write an ordinary wrapper that takes only one-letter arguments and, therefore, can use just simple Getopt. An example of such wrapper could be this: use Getopt::Std; our ($opt_a, $opt_b, $opt_c); getopt ('abc'); exec ('echo', $opt_a, $opt_b, $opt_c); converting: -a value1 -b value2 -c value3 into: value1 value2 value3 Cheers, Martin -- Martin Senger email: mar...@gm...,m.s...@cg... skype: martinsenger |