From: David B. <bd...@us...> - 2006-03-29 21:07:18
|
Tim, We're really talking about 2 different types of scripts. With STAX you can use <script> elements that contain Python code (and they can only contain Python code). For scripts in general, when you use a <process> element in STAX, it can be used to execute any type of executable or script (Perl, Python, TCL, shell scripts, etc.). Let me know if you have any additional questions. David Bender STAF/STAX Development 8-1268 (512-838-1268) IBM Austin Bldg. 903-5B002 Internet: bd...@us... "Tim Broad" <Tim...@no...> Sent by: sta...@li... 03/29/2006 02:58 PM To "David Bender" <David_Bender%IB...@no...> cc sta...@li..., sta...@li... Subject Re: [staf-users] Help getting perl to work in STAF Hi David, Thank you, that is very helpful. Just to make sure. Is it true then that STAF can only run perl scripts? I thought that I saw in a discussion db that you could actually use Perl code within STAF code. I am trying to get rid of additional scripts and incorporate everything into a STAF xml file. Thanks, Tim 978 399 6012 David Bender/Austin/IBM @IBMUS To Sent by: sta...@li... staf-users-admin@ cc lists.sourceforge Tim...@no... .net Subject Re: [staf-users] Help getting perl to work in STAF 03/29/2006 03:27 PM To execute a Perl script within STAX you would run it via a <process> element. Here is a simple STAX job that demonstrates how to run a Perl script. If you had file c:/temp/test.pl which contains: print "Hello world"; Here is a STAX job that executes the Perl script: <?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE stax SYSTEM "stax.dtd"> <stax> <defaultcall function="main"/> <function name="main"> <sequence> <process> <location>'local'</location> <command mode="'shell'">'c:/perl/bin/perl c:/temp/test.pl'</command> <stderr mode="'stdout'"/> <returnstdout/> </process> <message log="1">STAXResult</message> </sequence> </function> </stax> Here is the message/log output of running this: [[0, 'Hello world']] If you have further questions let me know. David Bender STAF/STAX Development 8-1268 (512-838-1268) IBM Austin Bldg. 903-5B002 Internet: bd...@us... "Tim Broad" <Tim...@no...> Sent by: sta...@li... 03/29/2006 01:52 PM To sta...@li... cc Subject [staf-users] Help getting perl to work in STAF Never having done this before, I am looking for some basic pointers on how to port some Perl script to STAF. I would be interested in how to do this both keeping it as Perl and also converting it to Jython. I have been searching the web and playing around with some basic commands, but am obviously missing some early steps. I read e.g that Perl must execute in a <process></process> and not <script> My questions are what <></> wrappers have to go around this? I have both python and perl in my STAF bin directories. Are there any other critical environment variables that I need on my machine? Should this Perl work as is or do I have to modify it in any way. Any good references you might suggest? Here is the Perl script: $VersionFile = $ARGV[0].'\\inc\\version.h'; open(VER, "<$VersionFile") or die("\n*** Failed to open $VersionFile: $!\a\a\a\n\n"); @VersionLine = grep(/define VERSION_BUILD\s*\"/,<VER>); close(VER); $VersionLine[0] =~m/define VERSION_BUILD\s*\"(.*)\"/; die("Failed to extract version string from version.h" ) if ($1 eq ""); $BuildNum = $1; #remove "build" from the begining if present $BuildNum =~ s/^build //i; $BuildStr = substr($BuildNum, 0,2); $BuildPre = $BuildNum; substr($BuildPre, -8) = ""; $BuildDate = substr($BuildNum, -8); Thanks, Tim 978 399 6012 ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ staf-users mailing list sta...@li... https://lists.sourceforge.net/lists/listinfo/staf-users ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ staf-users mailing list sta...@li... https://lists.sourceforge.net/lists/listinfo/staf-users |