Sys::Proctitle - modify proctitle on Linux
use Sys::Proctitle qw/:all/; setproctitle( "my new title" ); setproctitle( qw/my new title/ ); $s=getproctitle; or { # set proctitle while in block my $proctitle=Sys::Proctitle->new( 'my new title' ); ... }
Sys::Proctitle provides an interface for setting the process title shown by ps, top or similar tools on Linux. Why do we need this? One could simply change $0 to achieve the same result. Well, first setting $0 did not work with 5.8.0. Further, setting $0 won't work with mod_perl.
Sys::Proctitle
ps
top
$0
all arguments are joined with \0. The resulting string is set as process title.
\0
returns the current process title. On Linux the space useable as process title consists of the original space for argv the process was executed with plus the space of the original environment. This function returns the current content of this buffer.
The length of the returned string is the maximum process title length.
the current process title is saved. Then the arguments are passed to setproctitle.
setproctitle
restores the saved process title.
None by default.
On demand setproctitle and getproctitle are exported.
getproctitle
The :all Exporter tag exports setproctitle and getproctitle.
:all
Apache::ShowStatus
Torsten Foertsch, <torsten.foertsch@gmx.net>
Copyright (C) 2004 by Torsten Foertsch
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Sys::Proctitle, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sys::Proctitle
CPAN shell
perl -MCPAN -e shell install Sys::Proctitle
For more information on module installation, please visit the detailed CPAN module installation guide.