in reply to /proc Gimmicks (Linux specific)
/proc/$$/ can be replaced by the fixed path /proc/self/ . The self entry is a rather magical symlink.
Additionally, /proc/self/status is a human-readable form of stat which gives names to the data, all set to make a hash from. Here's the command line version:
$ perl -e 'open STATUS, "< /proc/self/status"; my $status = {map {split /:\s*/} <STATUS>}; close(STATUS);print "$_ => $status->{$_}" for keys %$status' Groups => 501 101 102 SigCgt => 0000000000000000 SigIgn => 8000000000000000 State => R (running) Name => perl Uid => 501 501 501 501 CapPrm => 0000000000000000 CapEff => 0000000000000000 SigPnd => 0000000000000000 VmExe => 488 kB FDSize => 256 PPid => 1341 CapInh => 0000000000000000 Gid => 501 501 501 501 VmStk => 20 kB VmLib => 1240 kB VmRSS => 1148 kB SigBlk => 0000000000000000 Pid => 10847 VmLck => 0 kB VmData => 316 kB TracerPid => 0 VmSize => 2280 kB
There are lots of treasures in Linux /proc . That makes ordinary filesystem access a viable alternative to the Proc:: family of CPAN modules.
After Compline,
Zaxo
|
|---|