in reply to How to Find the Script that Called it
I'd second what Joost said. As an example of a platform specific approach, you could do something like this on systems with a /proc file system (the example is for Linux, but it should be quite similar elsewhere):
#!/usr/bin/perl my $ppid = getppid(); # parent PID my $procfile = "/proc/$ppid/cmdline"; open my $fh, "<", $procfile or die "Cannot open $procfile: $!"; my $cmdline = <$fh>; $cmdline =~ tr/\0/ /; close $fh; print "cmdline: $cmdline\n";
As already said, this would require that the parent process is still running.
|
|---|