in reply to caller of perl script

As you have observed, caller works only inside a Perl process.

With getppid you can the the PID of the parent process, which is often also the calling process.

Depending on your operating systems, there are probably ways to map that PID to a process name, which might or might not be related to the caller's name.

I'm curious, why do you need that? Maybe there's another way to achieve your goal in a different way.

Replies are listed 'Best First'.
Re^2: caller of perl script
by Anonymous Monk on Jun 11, 2010 at 15:26 UTC
    moritz: OP mentioned a .BAT file. Is getppid implemented on Windows?

    OP: If you have any control over the calling script, could you modify it to leave tracks in an environment variable?

      moritz: OP mentioned a .BAT file. Is getppid implemented on Windows?

      Concluding the operating system from a file extension is a fragile business. I think that mono uses .exe executables on linux.

      Also there are a lot of different systems that use .BAT - the difference between DOS 6.0 and Windows 7 are striking.

      Perl 6 - links to (nearly) everything that is Perl 6.
        What's wrong with $^O ?
      OP mentions both bat and shell, which likely means both Windows and Unix. most of the responses reference Windows. sadly, modules for Windows (e.g. Windows::...) can't be used in Unix. it's also likely that wild and crazy modules (though we love 'em) may not be an option. OP could be in a locked down environment where they've got to use what they've got.