By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,660 Members | 1,299 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,660 IT Pros & Developers. It's quick & easy.

Running a process in background and making a GUI

P: 2
I need to read a log file (real-time) and select only data that I need(filtering) and make a GUI to display the data.

I am getting stuck at the point of being able to process both the log file and the perl script simultaneously. For instance, if I invoke the process(which runs infinitely, since its real-time) in the perl script, the perl script is temporarily suspended. I want the process to run in the background and the perl script to do the necessary filtering etc, and display the required data.

I have been trying to use win32::process to run the process in background. But I am getting some strange errors, with regard to syntax(below is the log of the error). Do we need to have some other plugin/software to run this. I am new to Perl, and this may be a very silly question to some of you, but I have problems running the following script.I am using windows XP cmd to run it.

This is a process to open a notepad, I have not been able to run this.
my $ProcessObj;
Win32::Process::Create($ProcessObj,
'C:\\WINDOWS\\system32\\notepad.exe',
'notepad temp.txt',
0,
NORMAL_PRIORITY_CLASS,
'.') or die $!;


Also, I would like to know if making a GUI (to display some plots of continuous data) is possible in Perl?

Any help would be highly appreciated :)
Thanks a lot!


Expand|Select|Wrap|Line Numbers
  1. Error Log:
  2. ------------
  3. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  4. near "rtf1\"
  5. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  6. near "ansi\"
  7. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  8. near "ansicpg1252\"
  9. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  10. near "deff0\"
  11. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  12. near "f0\"
  13. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  14. near "fmodern\"
  15. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  16. near "fprq1\"
  17. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  18. near "f1\"
  19. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
  20. near "fswiss\"
  21. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 2,
  22. near "red0\"
  23. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 2,
  24. near "green0\"
  25. Bareword found where operator expected at C:\Perl\site\bin\testproc.pl line 3, n
  26. ear "*\generator"
  27.         (Missing operator before generator?)
  28. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
  29. near "viewkind4\"
  30. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
  31. near "uc1\"
  32. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
  33. near "pard\"
  34. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
  35. near "cf1\"
  36. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
  37. near "f0\"
  38. String found where operator expected at C:\Perl\site\bin\testproc.pl line 5, nea
  39. r "par
  40. 'C:\\\\WINDOWS\\\\system32\\\\notepad.exe'"
  41.         (Missing semicolon on previous line?)
  42. String found where operator expected at C:\Perl\site\bin\testproc.pl line 6, nea
  43. r "par
  44. 'notepad temp.txt'"
  45.         (Missing semicolon on previous line?)
  46. Number found where operator expected at C:\Perl\site\bin\testproc.pl line 7, nea
  47. r "par
  48. 0"
  49.         (Missing semicolon on previous line?)
  50. String found where operator expected at C:\Perl\site\bin\testproc.pl line 9, nea
  51. r "par
  52. '.'"
  53.         (Missing semicolon on previous line?)
  54. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 9,
  55. near "cf0\"
  56. Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 9,
  57. near "f1\"
  58. syntax error at C:\Perl\site\bin\testproc.pl line 1, near "rtf1\"
  59. syntax error at C:\Perl\site\bin\testproc.pl line 1, near "f1\"
  60. syntax error at C:\Perl\site\bin\testproc.pl line 1, near "}}"
  61. syntax error at C:\Perl\site\bin\testproc.pl line 2, near "red0\"
  62. syntax error at C:\Perl\site\bin\testproc.pl line 5, near "par
  63. 'C:\\\\WINDOWS\\\\system32\\\\notepad.exe'"
  64. syntax error at C:\Perl\site\bin\testproc.pl line 9, near "cf0\"
  65. Execution of C:\Perl\site\bin\testproc.pl aborted due to compilation errors.
May 25 '10 #1
Share this Question
Share on Google+
3 Replies


Expert Mod 100+
P: 589
It's impossible for us to troubleshoot your script without seeing it.

Based on your description, I can't fathom why you would need to run notepad.

Yes, Perl can be used to create a gui.

See: perldoc -q "How can I write a GUI"
http://faq.perl.org/perlfaq3.html#How_can_I_write_a_GU
May 25 '10 #2

P: 2
I was just trying to test running a process(notepad). But it is actually for another process "abc xyz". This is all the script there is:

my $ProcessObj;
Win32::Process::Create($ProcessObj,
'C:\\WINDOWS\\system32\\notepad.exe',
'notepad temp.txt',
0,
NORMAL_PRIORITY_CLASS,
'.') or die $!;



I am not able to run the process even with notepad. Do you know what the reason could be?
May 26 '10 #3

Expert Mod 100+
P: 589
Clearly that's not your complete script as you claim. So, unless and until you're willing to be honest and show use your real test code, there's nothing that anyone can do to help you troubleshoot your script.
May 26 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.