13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

my $dir = (getpwname($user))[7]or corak "@{ [&whowasi] }: no user $user";$dir .= "/$dotdir" if $dotdir;my $node = {USER => $user,HOME => $dir,CONTENTS => {},CLOBBER => 0,};opendir DIR, $diror croak "@{[&whowasi]}: can't opendir $dir: $!";for my $dot ( grep /^\./ && -f "$dir/$_", readdir(DIR)) {$dot =~ s/^\.//;$node->{CONTENTS}{$dot} = undef;}closedir DIR;return bless $node, $self;}值 得 一 提 的 是 , 如 果 你 准 备 用 文 件 来 测 试 上 面 的 readdir 的 返 回 值 , 你 最 好 预 先 准 备 好有 问 题 的 目 录 ( 象 我 们 一 样 )。 否 则 , 因 为 我 们 没 有 用 chdir, 所 以 你 很 有 可 能 测 试 的 是错 误 的 文 件 。SELF->FETCH(KEY)370

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!