Tuesday, 15 June 2010

Perl Script Output Capture Problem using C# -


I was following one of the threads to run Perl script from my C # program.

My C # code is like this:

  Private Zero RunScript (ArrayList selectedScriptFileList) {foreach (curated scriptScriptName on selectedScriptFileList} {ProcessStartInfo myProcessStartInfo = New ProcessStartInfo ("perl. Exe "); MyProcessStartInfo.Arguments = (string) (curScriptFileName); MyProcessStartInfo.UseShellExecute = false; MyProcessStartInfo.RedirectStandardOutput = True; MyProcessStartInfo.WindowStyle = Process WindowStyle.Hidden; MyProcessStartInfo.CreateNoWindow = True; MyProcess.StartInfo = myProcessStartInfo; MyProcess.Start (); MyProcess.WaitForExit (); String output = myProcess.StandardOutput.ReadToEnd (); This.ScriptTestResultTextBox.AppendText (Production); }}  

and my perl script requires XML parsing. I can read the print statement before XML parsing, but not after the parsing started. The script runs on the DoS shell

Here is part of my script:.

  print ("\ n"); Print ("*********************** test1.pl ********************************* ); Print ("\ n"); Print ("1"); Print ("2"); My $ scriptName = 'test1.pl'; My $ file = '../../ScriptParamLib.xml'; My $ parser = xml :: libax ml- & gt; new (); My $ tree = $ parse- & gt; Parasfoil ($ file); My $ root = $ tree- & gt; GetDocumentElement; My @species = $ root- & gt; GetElementsByTagName ('test_node'); Print ("access to XML data base ... \ n");  

The C # test box only shows the first three print statements, but the last one does not know anyone why?

Thanks

"itemprop =" text ">

I thought I should roll my comment in since a reply They proved to be helpful:

Using a full path to the $ file to work in a Perl script, with the most likely directories working on this issue There is some process that arises from the C # program that you can see in the Perl script by actually using it What is a working directory? If this is not your hope, then try to establish it through the property of Procststiton in its C # program, the relative path should work fine after that.


No comments:

Post a Comment