Everyone, thank you for the replies. Here is what I ended up with for a getppid that works platforms that support getppid() and Windows (comments welcome):
sub _getppid() { my $ppid; if ($^O =~ /^MSWin/) { my $pid = $$; my $machine = "\\\\."; require Win32::OLE; require Win32::OLE::Variant; # WMI Win32_Process class my $class = "winmgmts:{impersonationLevel=impersonate}$machine\\Root\\cimv2"; if (my $wmi = Win32::OLE->GetObject($class)) { if(my $proc=$wmi->Get(qq{Win32_Process.Handle="$pid"})) { $ppid = $proc->{ParentProcessId} if ($proc->{ParentProcessId}!=0); } } } else { $ppid = getppid(); } return $ppid; } ________________________________________ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Couball Sent: Thursday, May 03, 2007 3:20 PM To: activeperl@listserv.ActiveState.com Subject: getppid() on Windows Is there a way to get the parent process id of a Windows process just like getppid() (since getppid() doesn't seem to be implemented in ActiveState perl)? Sincerely, James Couball _______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs