in reply to In what OS and Perl version set $0 works?

What's the use, it doesen't work well even when it does work: (linux,5.6) Try:
perl -le '$0="IT_WORKS";while(1) {}'&
and look at whats on top of top. That's right, 'perl', and not 'IT_WORKS', although ps aux|grep IT_WORKS seems to indicate it works. So now maybe killall IT_WORKS works? Nope, it doesen't. (To make top recognize the change, press 'c', as 'show command line')

Am I missing something?

Replies are listed 'Best First'.
Re: Re: In what OS and Perl version set $0 works?
by Fletch (Bishop) on Apr 14, 2004 at 12:23 UTC

    On Linux top is probably doing something akin to readlink( "/proc/##/exe" ) to get the process name, which wouldn't be changed by mucking with $0 (or by diddling argv[0] from C) since /proc is comming from the kernel's process table directly.

    ( Not that that makes it work, but it at least might explain the behavior. )