summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command/FileUtils.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-04-07 12:13:02 +0000
committerfukachan <fukachan>2002-04-07 12:13:02 +0000
commiteab38d001d7f459bfe8c940d1905f72f92ff33d7 (patch)
treeb72f8c265c515429ec44e97601a731771a906210 /fml/lib/FML/Command/FileUtils.pm
parent98dde351410282433875892b6f589a8a0b5e33f1 (diff)
downloadfml8-eab38d001d7f459bfe8c940d1905f72f92ff33d7.tar.gz
fml8-eab38d001d7f459bfe8c940d1905f72f92ff33d7.tar.bz2
fml8-eab38d001d7f459bfe8c940d1905f72f92ff33d7.zip
admin_member_passwd_maps -> admin_member_password_maps
more friendly variable name syntax more comments, documents
Diffstat (limited to 'fml/lib/FML/Command/FileUtils.pm')
-rw-r--r--fml/lib/FML/Command/FileUtils.pm29
1 files changed, 17 insertions, 12 deletions
diff --git a/fml/lib/FML/Command/FileUtils.pm b/fml/lib/FML/Command/FileUtils.pm
index 50e1e1ab..addf1184 100644
--- a/fml/lib/FML/Command/FileUtils.pm
+++ b/fml/lib/FML/Command/FileUtils.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: FileUtils.pm,v 1.1 2002/03/26 04:01:35 fukachan Exp $
+# $FML: FileUtils.pm,v 1.2 2002/03/30 11:08:34 fukachan Exp $
#
package FML::Command::FileUtils;
@@ -45,6 +45,10 @@ sub new
}
+# Descriptions: remove files
+# Arguments: OBJ($self) ... varargs ...
+# Side Effects: remove files
+# Return Value: same as remove()
sub delete
{
my ($self, @p) = @_;
@@ -60,25 +64,26 @@ sub delete
sub remove
{
my ($self, $curproc, $command_args, $du_args) = @_;
- my $config = $curproc->{ config };
- my $argv = $du_args->{ options };
- my $is_warn = 0;
+ my $config = $curproc->{ config };
+ my $argv = $du_args->{ options };
+ my $is_error = 0;
# regexp
my $basic_variable = $self->{ _basic_variable };
- my $regexp = $basic_variable->{ file };
+ my $file_regexp = $basic_variable->{ file };
+ my $ml_home_dir = $config->{ ml_home_dir };
- my $ml_home_dir = $config->{ ml_home_dir };
- chdir $ml_home_dir;
+ # chdir $ml_home_dir firstly. return ASAP if failed.
+ chdir $ml_home_dir || croak("cannot chdir \$ml_home_dir");
for my $file (@$argv) {
- if ($file =~ /^$regexp$/) {
+ if ($file =~ /^$file_regexp$/) {
if (-f $file) {
unlink $file;
if (-f $file) {
LogError("fail to remove $file");
- $is_warn++;
+ $is_error++;
}
else {
Log("remove $file");
@@ -88,11 +93,11 @@ sub remove
}
}
else {
+ LogWarn("no such file $file");
$curproc->reply_message_nl("command.no_such_file",
"no such file $file",
{ _arg_file => $file } );
- LogWarn("no such file $file");
- $is_warn++;
+ $is_error++;
}
}
else {
@@ -102,7 +107,7 @@ sub remove
}
}
- if ($is_warn) {
+ if ($is_error) {
croak("remove: something fail.");
}
}