Skip to main content

Posts

Showing posts from November, 2013

Creating Win32 Process in Perl and handling priority of process

Main.pl -> parent process use strict; use warnings; use function; use Win32::Process; use constant ABOVE_NORMAL_PRIORITY_CLASS => 0x00008000; my $cmd="C:\\windows\\system32\\cmd.exe"; my $params = "cmd.exe /c perl.exe C:\\Dropbox\\Pet_Projects\\perl_process\\process.pl"; my $startFolder = shift || q{.}; my $procobj; print "\n before calling the child process \n"; #Creates a process with the command and the params and flags Win32::Process::Create( $procobj,$cmd, $params, 0,CREATE_NEW_CONSOLE|                                  ABOVE_NORMAL_PRIORITY_CLASS , $startFolder ); $procobj->Wait(INFINITE); -> wait for child to complete print "\n after calling the child process \n"; Process.pl -> child process use strict; use warnings; use function; for (my $i =0;$i < 120;$i++) {                 sleep 5;                 print_name(); } Return; Function.pm -> Header file c