summaryrefslogtreecommitdiff
path: root/fml/lib/FML/Command/User
diff options
context:
space:
mode:
authorfukachan <fukachan>2006-03-05 09:41:48 +0000
committerfukachan <fukachan>2006-03-05 09:41:48 +0000
commitac126cdf370f7bd5bcff6dc1482b655a99ce5759 (patch)
treea1b51c1c6cefa9baa9e3c3459e73a44f09808085 /fml/lib/FML/Command/User
parent6940f468f92ec8044c1982a4f7b12b4f4637a418 (diff)
downloadfml8-ac126cdf370f7bd5bcff6dc1482b655a99ce5759.tar.gz
fml8-ac126cdf370f7bd5bcff6dc1482b655a99ce5759.tar.bz2
fml8-ac126cdf370f7bd5bcff6dc1482b655a99ce5759.zip
duplicate FML::Context::Command object by object dup method not by myself.
Diffstat (limited to 'fml/lib/FML/Command/User')
-rw-r--r--fml/lib/FML/Command/User/admin.pm21
1 files changed, 9 insertions, 12 deletions
diff --git a/fml/lib/FML/Command/User/admin.pm b/fml/lib/FML/Command/User/admin.pm
index cd171b27..a5e16170 100644
--- a/fml/lib/FML/Command/User/admin.pm
+++ b/fml/lib/FML/Command/User/admin.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: admin.pm,v 1.16 2006/03/04 13:48:29 fukachan Exp $
+# $FML: admin.pm,v 1.17 2006/03/05 08:08:37 fukachan Exp $
#
package FML::Command::User::admin;
@@ -285,11 +285,11 @@ sub _apply_new_admin_command_mail_restrictions
sub _execute_admin_command
{
my ($self, $curproc, $command_context, $class) = @_;
- my $args = $self->_prepare_command_context($curproc, $command_context);
+ my $_context = $self->_dup_command_context($curproc, $command_context);
use FML::Command;
my $dispatch = new FML::Command;
- $dispatch->$class($curproc, $args);
+ $dispatch->$class($curproc, $_context);
}
@@ -297,25 +297,22 @@ sub _execute_admin_command
# Arguments: OBJ($self) OBJ($curproc) OBJ($command_context)
# Side Effects: none
# Return Value: none
-sub _prepare_command_context
+sub _dup_command_context
{
my ($self, $curproc, $command_context) = @_;
# duplicate $command_context HASH_REF.
- my $args = {};
- for my $k (keys %$command_context) {
- $args->{ $k } = $command_context->{ $k };
- }
- $args->{ command_mode } = 'Admin';
+ my $_context = $command_context->dup();
+ $_context->set_mode("Admin");
# we need to shift "options" by one column in admin command.
# e.g. for "admin add some thing",
# options = [ add, some, thing ] => [ some, thing ]
- my @options = @{ $command_context->get_options() };
+ my (@options) = @{ $command_context->get_options() };
shift @options;
- $args->{ options } = \@options;
+ $_context->set_options(\@options);
- return $args;
+ return $_context;
}