/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


In reply to Re: /proc Gimmicks (Linux specific) by Zaxo
in thread /proc Gimmicks (Linux specific) by PetaMem

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.