[Memphis.pm] perl discovery of the day
perl at erd3.com
perl at erd3.com
Wed Nov 22 01:45:17 CST 2000
On Tue, 21 Nov 2000, Carl Brock Sides wrote:
> Did you know you can affect how your perl process appears in a "ps"
> listing by writing to $0?
<snip>
You can also do it in C. I had a utility that required the password to be
passed on the command line. It ran in the background like a daemon. When
you did a 'ps auwwx' the password was visable. I modified the program so
that it set all of it's arguments to a zero byte string. No more password
in ps. <grin>
>
> #/usr/bin/perl
> #.: .|-| ::||-| .||-:: ::|||-| :|-. :||-:: .:-| |-| 0-| .-| |||
> #0 ||-:: ::|||-| |||-| |-| 0-| .-| |||-.: ::-:: :|||-| :|||
> #| .|||-| .||-.| :-| .||-| ||-| .-: .|-:: ::|||-| .||-| ::|
> open(Q,$0);while(<Q>){if(/^#(.*)$/){for(split('-',$1)){$q=0;$qq=0;
> for(split){s/\|/:.:/g;s/:/../g;$Q=$_?length:$_;$q+=$qq?$Q:$Q*20;
> $qq++;}print chr($q);}}}print"\n";
> __END__
I know what the above code does, could you explain how it does it?
Reece Dike
----------------------------------------------------------------------------
To unsubscribe, please send email to majordomo at pm.org
with 'unsubscribe memphis-pm-list' in the body of the message.
----------------------------------------------------------------------------
More information about the Memphis-pm
mailing list