summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-03-24 14:32:57 +0000
committerfukachan <fukachan>2001-03-24 14:32:57 +0000
commitd2ec46bb97b8adaf11bfb43a9cb60205cddd0f07 (patch)
tree53ec786c12d04e524877f14e676eb16ce08ac231
parenta3e125a194ae5d06f5794e7abf975187975559bb (diff)
downloadfml8-d2ec46bb97b8adaf11bfb43a9cb60205cddd0f07.tar.gz
fml8-d2ec46bb97b8adaf11bfb43a9cb60205cddd0f07.tar.bz2
fml8-d2ec46bb97b8adaf11bfb43a9cb60205cddd0f07.zip
move lock/unlock to FML::Command class
-rw-r--r--fml/lib/FML/Command.pm9
-rw-r--r--fml/lib/FML/Process/CGI.pm9
-rw-r--r--fml/lib/FML/Process/Configure.pm9
3 files changed, 9 insertions, 18 deletions
diff --git a/fml/lib/FML/Command.pm b/fml/lib/FML/Command.pm
index e6fe26dd..b5e73f4c 100644
--- a/fml/lib/FML/Command.pm
+++ b/fml/lib/FML/Command.pm
@@ -55,7 +55,9 @@ sub AUTOLOAD
eval qq{ require $pkg; $pkg->import();};
unless ($@) {
if ($pkg->can($command)) {
+ $curproc->lock() if $self->require_lock($command);
$pkg->$command($curproc, $args);
+ $curproc->unlock() if $self->require_lock($command);
}
else {
Log("$pkg module has no $command method");
@@ -67,6 +69,13 @@ sub AUTOLOAD
}
+sub require_lock
+{
+ my ($self, $command) = @_;
+ $command eq 'newml' ? 0 : 1;
+}
+
+
=head1 AUTHOR
Ken'ichi Fukamachi
diff --git a/fml/lib/FML/Process/CGI.pm b/fml/lib/FML/Process/CGI.pm
index d4744ad2..3fad5b10 100644
--- a/fml/lib/FML/Process/CGI.pm
+++ b/fml/lib/FML/Process/CGI.pm
@@ -147,18 +147,9 @@ sub _makefml
Log("makefml.cgi ml_name=$ml_name command=$method address=$address");
# here we go
- $curproc->lock() if $curproc->_makefml_require_lock($method);
require FML::Command;
my $obj = new FML::Command;
$obj->$method($curproc, $optargs);
- $curproc->unlock() if $curproc->_makefml_require_lock($method);
-}
-
-
-sub _makefml_require_lock
-{
- my ($self, $command) = @_;
- $command eq 'newml' ? 0 : 1;
}
diff --git a/fml/lib/FML/Process/Configure.pm b/fml/lib/FML/Process/Configure.pm
index 6aca7694..91016b70 100644
--- a/fml/lib/FML/Process/Configure.pm
+++ b/fml/lib/FML/Process/Configure.pm
@@ -120,18 +120,9 @@ sub _makefml
};
# here we go
- $curproc->lock() if $curproc->_makefml_require_lock($method);
require FML::Command;
my $obj = new FML::Command;
$obj->$method($curproc, $optargs);
- $curproc->unlock() if $curproc->_makefml_require_lock($method);
-}
-
-
-sub _makefml_require_lock
-{
- my ($self, $command) = @_;
- $command eq 'newml' ? 0 : 1;
}