TStanley has asked for the wisdom of the Perl Monks concerning the following question:
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.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; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Module addition
by Beatnik (Parson) on Jan 04, 2002 at 04:13 UTC | |
Re: Module addition
by frag (Hermit) on Jan 04, 2002 at 04:20 UTC | |
Re: Module addition
by TStanley (Canon) on Jan 04, 2002 at 17:14 UTC |