I found such behaviour of the "getlogin" when maked some asynchronous testsuite with profiling. Simplified examples:
[dim@grivo out]$ sh -c "/usr/bin/time perl -e '$|=1; print getlogin(), + chr(10)'" dim 0.00user 0.00system 0:00.00elapsed 100%CPU (0avgtext+0avgdata 0maxresi +dent)k 0inputs+0outputs (0major+393minor)pagefaults 0swaps [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ sh -c "/usr/bin/time perl -e '$|=1; print getlogin(), + chr(10)' & wait" 0.00user 0.00system 0:00.00elapsed 50%CPU (0avgtext+0avgdata 0maxresid +ent)k 0inputs+0outputs (0major+386minor)pagefaults 0swaps [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ sh -c "/usr/bin/time perl -e '$|=1; print \$ENV{USER} +, chr(10)' & wait" dim 0.00user 0.00system 0:00.00elapsed 50%CPU (0avgtext+0avgdata 0maxresid +ent)k 0inputs+0outputs (0major+383minor)pagefaults 0swaps [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ [dim@grivo out]$ uname -a Linux grivo.bq 2.6.21-1.3194.fc7 #1 SMP Wed May 23 22:35:01 EDT 2007 i +686 i686 i386 GNU/Linux [dim@grivo out]$ [dim@grivo out]$

In reply to Why "getlogin" not works in this case? by bdimych

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.