in reply to Perl progname

If you have the /proc filesystem, the most you can do is get the pid with $$, then check /proc/$pid/cmdline to get the full path to the executable.

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^2: Perl progname
by alexm (Chaplain) on Aug 06, 2008 at 17:10 UTC
    then check /proc/$pid/cmdline ...

    cmdline doesn't exist in Solaris /proc. Proc-ProcessTable does the trick on several platforms:

    use strict; use warnings; use Proc::ProcessTable; my $proc_table = Proc::ProcessTable->new->table; my ($process) = grep { $_->pid == $$ } @$proc_table; print $process->cmndline, "\n";
Re^2: Perl progname
by AltBlue (Chaplain) on Aug 07, 2008 at 15:21 UTC
    /proc/$$/cmdline will reflect $0's modification, e.g.:
    $ perl -le '$0="foo"; print qx "cat /proc/$$/cmdline"' foo