diff options
| author | fukachan <fukachan> | 2002-04-27 07:23:42 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-04-27 07:23:42 +0000 |
| commit | 9046fb1379bbd081aa6a5e01be9e1cdd089d0b77 (patch) | |
| tree | ae4a18effd3488e45a10d563a8adf1d20c1559e1 /fml/lib/FML/Process/Kernel.pm | |
| parent | 16c2798d169278b77b798430ab3df5ef75e26e4d (diff) | |
| download | fml8-9046fb1379bbd081aa6a5e01be9e1cdd089d0b77.tar.gz fml8-9046fb1379bbd081aa6a5e01be9e1cdd089d0b77.tar.bz2 fml8-9046fb1379bbd081aa6a5e01be9e1cdd089d0b77.zip | |
implement parse_exception()
implement message_nl() to separete message converter into natural
language and message handling parts
Diffstat (limited to 'fml/lib/FML/Process/Kernel.pm')
| -rw-r--r-- | fml/lib/FML/Process/Kernel.pm | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/fml/lib/FML/Process/Kernel.pm b/fml/lib/FML/Process/Kernel.pm index acf72394..a5c53254 100644 --- a/fml/lib/FML/Process/Kernel.pm +++ b/fml/lib/FML/Process/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.89 2002/04/26 10:29:13 fukachan Exp $ +# $FML: Kernel.pm,v 1.90 2002/04/27 05:23:32 fukachan Exp $ # package FML::Process::Kernel; @@ -746,6 +746,27 @@ sub reply_message_nl { my ($curproc, $class, $default_msg, $args) = @_; my $config = $curproc->{ config }; + my $buf = $curproc->message_nl($class, $default_msg, $args); + + if (defined $buf) { + eval q{ + use FML::Language::ISO2022JP qw(STR2JIS); + }; + if ($buf =~ /\$/) { + $config->expand_variable_in_buffer(\$buf, $args); + } + $curproc->reply_message(STR2JIS( $buf ), $args); + } + else { + $curproc->reply_message($default_msg, $args); + } +} + + +sub message_nl +{ + my ($curproc, $class, $default_msg, $args) = @_; + my $config = $curproc->{ config }; my $dir = $config->{ message_template_dir }; my $buf = ''; @@ -765,18 +786,7 @@ sub reply_message_nl LogWarn("no such file: $file"); } - if (defined $buf) { - eval q{ - use FML::Language::ISO2022JP qw(STR2JIS); - }; - if ($buf =~ /\$/) { - $config->expand_variable_in_buffer(\$buf, $args); - } - $curproc->reply_message(STR2JIS( $buf ), $args); - } - else { - $curproc->reply_message($default_msg, $args); - } + return $buf; } @@ -1209,6 +1219,25 @@ sub prepare_file_to_return } +=head1 ERROR HANDLING + +=cut + + +sub parse_exception +{ + my ($curproc, $exception) = @_; + my $key = ''; + my $reason = ''; + + if ($exception =~ /__ERROR_(\S+)__:\s+(.*)/) { + ($key, $reason) = ($1, $2); + } + + return ($key, $reason); +} + + =head1 MISCELLANEOUS METHODS =cut |
