I am playing around with a possible improvement to the File::Slurp module that I would eventually submit to the author, but right now, I am running into a strange problem.

This is the piece of code that I am adding to the module:
sub read_long_dir{ my($d)=$_; my(@r); my $stats; my@r1=read_dir($d); foreach my $file(@r1){ my @stats=stat("$d/$file"); my($mode,$uid,$gid,$size,$atime)=@stats[2,4,5,7,8]; $uid=getpwuid($uid); $gid=getgrgid($gid); $atime=scalar localtime($atime); $mode=sprintf"%04o",$mode & 07777; $stats="$mode $uid $gid $size $atime $file"; push @r,$stats; } return @r; }
When I run the test program that I have as root, it runs fine, however, if I run the test as myself, it coredumps. Do the getgrgid/getpwuid functions need to be run as root? Any help would be appreciated.

TStanley
--------
"Suppose you were an idiot... And suppose you were a
member of Congress... But I repeat myself." -- Mark Twain

In reply to Module addition by TStanley

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.