BEGIN { my $PAR_PROGNAME = $ENV{PAR_PROGNAME}; use Win32::Process::Info(); my $pi = Win32::Process::Info->new(); my $parentpid = $pi->GetProcInfo( $$, { no_user_info => 1 } )->[0]->{ParentProcessId}; my $ExecutablePath = $pi->GetProcInfo( $parentpid, { no_user_info => 1 } )->[0] ->{ExecutablePath}; undef $pi; no Win32::Process::Info; sub IsParParentAlive { ## IsWin32ParParentAlive $PAR_PROGNAME eq $ExecutablePath ## doublecheck ## $ENV{PAR_SPAWNED} ## equivalent statement and kill 0, $parentpid; } } ## end BEGIN #### while( 1 ){ print " $$ doing stuff\n"; sleep 1; if( not IsParParentAlive() ){ die "ParParent is dead"; } }