There's a reason I said Linux... :)
The problem is that setting $0 is not implemented for Solaris, at least not in a way that would work. AFAIK, that's because (a) there is no system support for it (in the form of setproctitle(), etc.), so you'd have to resort to manipulating argv[] directly at the C level, and (b) the normal tools like ps (i.e. /usr/bin/ps) or ptree don't read the command+args from argv[] anyway, but rather from some other, harder to manipulate location, so you'd have to use /usr/ucb/ps (whose output can - to some degree - be influenced by a modified argv[]).
In case I have the time later, I'll see whether I can whip up a little XS routine which would allow to change the command name as it's shown by /usr/ucb/ps...
| [reply] [d/l] [select] |
use Sys::Prctl(prctl_name);
# Process name is now "My long process name"
my $oldname = prctl_name();
prctl_name("My long process name");
| [reply] [d/l] |
$ /usr/local/bin/perl Makefile.PL
# running Build.PL
/usr/local/bin/perl Build.PL
OS unsupported! Patches welcome :) at Build.PL line 5, <DATA> line 547
+.
...
$ uname -a
SunOS solaris10 5.10 Generic sun4u sparc SUNW,Sun-Blade-2500
| [reply] [d/l] |