13.07.2015 Views

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

Perl 语言编程 - Linux教程

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

tie %daemon_dots, "Dotfiles", "daemon";tied(%daemon_dots)->clobber(1);或 者 用 一 条 语 句 :(tie %daemon_dots, "DotFiles", "daemon")->clobber(1);clobber 方 法 只 是 简 单 的 几 行 :sub clobber{my $self = shift;$self->{CLOBBER} = @_ ? shift : 1;}SELF->DELETE(KEY)这 个 方 法 处 理 从 散 列 中 删 除 一 个 元 素 的 请 求 。 如 果 你 模 拟 的 散 列 在 某 些 地 方 用 了 真 的 散列 , 那 么 你 可 以 只 调 用 真 的 delete。 同 样 , 我 们 将 仔 细 检 查 用 户 是 否 真 的 想 删 除 文 件 :sub DELETE {carp &whowasi if $DEBUG;my $self = shift;my $dot = shift;my $file = $self->{HOME} . "./$dot";croak "@{[&whowasi]}: won't remove file $file"unless $self->{CLOBBER};373

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

Saved successfully!

Ooh no, something went wrong!