From d2ec46bb97b8adaf11bfb43a9cb60205cddd0f07 Mon Sep 17 00:00:00 2001 From: fukachan Date: Sat, 24 Mar 2001 14:32:57 +0000 Subject: move lock/unlock to FML::Command class --- fml/lib/FML/Command.pm | 9 +++++++++ fml/lib/FML/Process/CGI.pm | 9 --------- fml/lib/FML/Process/Configure.pm | 9 --------- 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; } -- cgit v1.2.1