From bb85781643278186368d692c1136826cd71870cc Mon Sep 17 00:00:00 2001 From: fukachan Date: Sat, 23 Mar 2002 12:20:25 +0000 Subject: implement rewrite_prompt(). It is used to hide password et. al. --- fml/lib/FML/Command.pm | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/fml/lib/FML/Command.pm b/fml/lib/FML/Command.pm index e770f7e0..596f6803 100644 --- a/fml/lib/FML/Command.pm +++ b/fml/lib/FML/Command.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: Command.pm,v 1.21 2002/02/19 13:32:43 fukachan Exp $ +# $FML: Command.pm,v 1.22 2002/02/20 13:59:48 fukachan Exp $ # package FML::Command; @@ -55,6 +55,27 @@ sub new } +# Descriptions: rewrite buffer +# Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) STR_REF($rbuf) +# Side Effects: none +# Return Value: none +sub rewrite_prompt +{ + my ($self, $curproc, $command_args, $rbuf) = @_; + my $command = undef; + my $comname = $command_args->{ comname }; + my $mode = $command_args->{'command_mode'} =~ /admin/i ? 'Admin' : 'User'; + my $pkg = "FML::Command::${mode}::${comname}"; + + eval qq{ use $pkg; \$command = new $pkg;}; + unless ($@) { + if ($command->can('rewrite_prompt')) { + $command->rewrite_prompt($curproc, $command_args, $rbuf); + } + } +} + + # Descriptions: ordinary destructor # Arguments: none # Side Effects: none -- cgit v1.2.1