diff options
| author | fukachan <fukachan> | 2002-03-18 15:21:31 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-03-18 15:21:31 +0000 |
| commit | 7f995250e8aeba35457875b845eb04531e4763f2 (patch) | |
| tree | ae729f38260e949684f35e4d718cb4a6d9f2b278 /fml/lib/FML/Process | |
| parent | 8d5c92e16a50b02f1ab3360b4098855283b9a0d2 (diff) | |
| download | fml8-7f995250e8aeba35457875b845eb04531e4763f2.tar.gz fml8-7f995250e8aeba35457875b845eb04531e4763f2.tar.bz2 fml8-7f995250e8aeba35457875b845eb04531e4763f2.zip | |
cosmetics
FNF
define cgi_execute_command() and try_get_address() into
FML::Process::CGI::Kernel and remove them from FML::CGI::Admin::Menu
Diffstat (limited to 'fml/lib/FML/Process')
| -rw-r--r-- | fml/lib/FML/Process/CGI/Kernel.pm | 83 |
1 files changed, 82 insertions, 1 deletions
diff --git a/fml/lib/FML/Process/CGI/Kernel.pm b/fml/lib/FML/Process/CGI/Kernel.pm index 6dcd07dc..1ac6e6e1 100644 --- a/fml/lib/FML/Process/CGI/Kernel.pm +++ b/fml/lib/FML/Process/CGI/Kernel.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: Kernel.pm,v 1.15 2002/02/02 15:24:19 fukachan Exp $ +# $FML: Kernel.pm,v 1.16 2002/03/18 13:52:20 fukachan Exp $ # package FML::Process::CGI::Kernel; @@ -311,6 +311,87 @@ sub get_recipient_list } +=head2 cgi_execute_command($args, $command_args) + +execute specified command given as FML::Command::* + +=cut + + +# Descriptions: execute FML::Command +# Arguments: OBJ($curproc) HASH_REF($args) HASH_REF($command_args) +# Side Effects: load module +# Return Value: none +sub cgi_execute_command +{ + my ($curproc, $args, $command_args) = @_; + + use FML::Command; + my $obj = new FML::Command; + if (defined $obj) { + my $comname = $command_args->{ comname }; + eval q{ + $obj->$comname($curproc, $command_args); + }; + unless ($@) { + print "OK! $comname succeed.\n"; + } + else { + print "Error! $comname fails.\n<BR>\n"; + if ($@ =~ /^(.*)\s+at\s+/) { + my $reason = $@; + print "<BR>\n"; + print $1; + print "<BR>\n"; + print $reason; + print "<BR>\n"; + } + } + } +} + + +=head2 try_get_address() + +return input address after validating the input + +=cut + + +# Descriptions: return input address after validating the input +# Arguments: OBJ($curproc) HASH_REF($args) +# Side Effects: longjmp() if critical error occurs. +# Return Value: STR +sub try_get_address +{ + my ($curproc, $args) = @_; + my $address = ''; + my $a = ''; + + eval q{ $a = $curproc->safe_param_address_specified();}; + unless ($@) { + $address = $a; + } + else { + # XXX longjmp() if insecure input is given. + my $r = $@; + if ($r =~ /ERROR\.INSECURE/) { croak($r);} + + eval q{ $a = $curproc->safe_param_address_selected();}; + unless ($@) { + $address = $a; + } + else { + # XXX longjmp() if insecure input is given. + my $r = $@; + if ($r =~ /ERROR\.INSECURE/) { croak($r);} + } + } + + return $address; +} + + =head2 safe_param_xxx() get and filter param('xxx') via AUTOLOAD(). |
