Philippe M. Chiasson wrote:
Philip M. Gollucci wrote:
pradeep kumar wrote:
save_scalar(gv); /* local $0 */
Mainly for my sanity and the archives:
$PROGRAM_NAME
$0 Contains the name of the program being executed.
On some (read: not all) operating systems assigning to $0 modi-
fies the argument area that the "ps" program sees. On some
platforms you may have to use special "ps" options or a differ-
ent "ps" to see the changes. Modifying the $0 is more useful
as a way of indicating the current program state than it is for
hiding the program you're running. (Mnemonic: same as sh and
ksh.)
Note that there are platform specific limitations on the the
maximum length of $0. In the most extreme case it may be lim-
ited to the space occupied by the original $0.
In some platforms there may be arbitrary amount of padding, for
example space characters, after the modified name as shown by
"ps". In some platforms this padding may extend all the way to
the original length of the argument area, no matter what you do
(this is the case for example with Linux 2.2).
Note for BSD users: setting $0 does not completely remove
"perl" from the ps(1) output. For example, setting $0 to "foo-
bar" may result in "perl: foobar (perl)" (whether both the
"perl: " prefix and the " (perl)" suffix are shown depends on
your exact BSD variant and version). This is an operating sys-
tem feature, Perl cannot help it.
In multithreaded scripts Perl coordinates the threads so that
any thread may modify its copy of the $0 and the change becomes
visible to ps(1) (assuming the operating system plays along).
Note that the the view of $0 the other threads have will not
change since they have their own copies of it.
--
END
------------------------------------------------------------
What doesn't kill us can only make us stronger.
Nothing is impossible.
Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/
Senior Developer / Liquidity Services, Inc.
http://www.liquidityservicesinc.com
http://www.liquidation.com
http://www.uksurplus.com
http://www.govliquidation.com
http://www.gowholesale.com