PriNet has asked for the wisdom of the Perl Monks concerning the following question:

Ok, I have been trying for some time now to get a separate script to run independently from the main "index.pl" script. After several attempts, the closest I have found (system, exec, ipc::run, etc. etc.) was the Win32::Process:Create() function. I have looked a "alot" of tutorials and examples and ended up with this:

use Win32::Process(); Win32::Process::Create( $Child_Module, "$ENV{SystemRoot}\\notepad.exe", "notepad testfile.txt", 0, Win32::Process::CREATE_NEW_CONSOLE(), "." );
And when I "execute" the script on Win32 Apache, I can see where the "task" starts up (via task manager on http server), but it doesn't show up on the (http servers) desktop. The task manager says it's running under "SYSTEM". I'm assuming it's not showing up on the desktop is because I'm signed in as 'username' not 'SYSTEM'. How to I get the Win32::Process::Create() to start up on the 'username' account rather than the 'SYSTEM' account so I can continue with my development?


I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...

Replies are listed 'Best First'.
Re: Win32 Process Create
by Anonymous Monk on Feb 16, 2015 at 01:46 UTC

    You want a CGI script to more or less directly execute a program with the user credentials of whoever is currently logged in to the server and have the window open up on their desktop?? This is one of those cases where there is almost certainly a better solution to whatever the bigger picture here is. Could you explain what you need this for?

    A design you might consider would be for the CGI script to write to a file or database, and have a second program, run by the currently logged in user, monitor that file or database for new things, and then take the appropriate action (such as run another program, for example).

      I'm trying to write a script that will communicate with my irc server so I can talk to other people that are on my webpage (I already have the who, what, and where for them) in a partioned out "messages" window on the right of my webpage. I know I'm not supposed to advertise here, but if you look at https://prinet.org (and give it a second to setup) you can see on the right side where I'm trying to inter-connect the irc server, where, I use my page script that can do it's own nick changes, channel changes, etc, I just want the "messages" in the right window.


      I tried re-inventing the wheel again, but everytime I push it, it still falls flat on it's side...
        I'm trying to write a script that will communicate with my irc server

        Your CGI could speak the IRC protocol with the appropriate modules - Why do you need to execute a program for this, especially one that opens a window on the desktop?

        There's also existing web-based IRC clients that you might be able to tie into your website. A quick google brings up https://kiwiirc.com/ or http://shout-irc.com/ among others.