Running a process in background and making a GUI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • perlbeginner
    New Member
    • May 2010
    • 2

    #1

    Running a process in background and making a GUI

    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($Proces sObj,
    'C:\\WINDOWS\\s ystem32\\notepa d.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!


    Code:
    Error Log:
    ------------
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "rtf1\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "ansi\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "ansicpg1252\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "deff0\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "f0\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "fmodern\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "fprq1\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "f1\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 1,
    near "fswiss\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 2,
    near "red0\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 2,
    near "green0\"
    Bareword found where operator expected at C:\Perl\site\bin\testproc.pl line 3, n
    ear "*\generator"
            (Missing operator before generator?)
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
    near "viewkind4\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
    near "uc1\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
    near "pard\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
    near "cf1\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 3,
    near "f0\"
    String found where operator expected at C:\Perl\site\bin\testproc.pl line 5, nea
    r "par
    'C:\\\\WINDOWS\\\\system32\\\\notepad.exe'"
            (Missing semicolon on previous line?)
    String found where operator expected at C:\Perl\site\bin\testproc.pl line 6, nea
    r "par
    'notepad temp.txt'"
            (Missing semicolon on previous line?)
    Number found where operator expected at C:\Perl\site\bin\testproc.pl line 7, nea
    r "par
    0"
            (Missing semicolon on previous line?)
    String found where operator expected at C:\Perl\site\bin\testproc.pl line 9, nea
    r "par
    '.'"
            (Missing semicolon on previous line?)
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 9,
    near "cf0\"
    Backslash found where operator expected at C:\Perl\site\bin\testproc.pl line 9,
    near "f1\"
    syntax error at C:\Perl\site\bin\testproc.pl line 1, near "rtf1\"
    syntax error at C:\Perl\site\bin\testproc.pl line 1, near "f1\"
    syntax error at C:\Perl\site\bin\testproc.pl line 1, near "}}"
    syntax error at C:\Perl\site\bin\testproc.pl line 2, near "red0\"
    syntax error at C:\Perl\site\bin\testproc.pl line 5, near "par
    'C:\\\\WINDOWS\\\\system32\\\\notepad.exe'"
    syntax error at C:\Perl\site\bin\testproc.pl line 9, near "cf0\"
    Execution of C:\Perl\site\bin\testproc.pl aborted due to compilation errors.
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    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"

    Comment

    • perlbeginner
      New Member
      • May 2010
      • 2

      #3
      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($Proces sObj,
      'C:\\WINDOWS\\s ystem32\\notepa d.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?

      Comment

      • RonB
        Recognized Expert Contributor
        • Jun 2009
        • 589

        #4
        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.

        Comment

        Working...