diff options
| author | fukachan <fukachan> | 2002-04-07 05:02:23 +0000 |
|---|---|---|
| committer | fukachan <fukachan> | 2002-04-07 05:02:23 +0000 |
| commit | e7da0f580eae88ef9738269db77852bfa1c66622 (patch) | |
| tree | c6f2b3a2c8db80f688d08d6542f2f8acff5ee299 /fml/lib/FML/Command | |
| parent | e85e92a3bab2412242d309b94fac20b4dc2e3bae (diff) | |
| download | fml8-e7da0f580eae88ef9738269db77852bfa1c66622.tar.gz fml8-e7da0f580eae88ef9738269db77852bfa1c66622.tar.bz2 fml8-e7da0f580eae88ef9738269db77852bfa1c66622.zip | |
fix/add comments
use HTML::FromText class to espace metchars
Diffstat (limited to 'fml/lib/FML/Command')
| -rw-r--r-- | fml/lib/FML/Command/Admin/log.pm | 39 |
1 files changed, 30 insertions, 9 deletions
diff --git a/fml/lib/FML/Command/Admin/log.pm b/fml/lib/FML/Command/Admin/log.pm index 13f8376b..e6f2519b 100644 --- a/fml/lib/FML/Command/Admin/log.pm +++ b/fml/lib/FML/Command/Admin/log.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: log.pm,v 1.1 2002/03/19 11:13:45 fukachan Exp $ +# $FML: log.pm,v 1.2 2002/03/30 11:08:35 fukachan Exp $ # package FML::Command::Admin::log; @@ -23,7 +23,7 @@ See C<FML::Command> for more details. =head1 DESCRIPTION -log a new address. +show log file(s). =head1 METHODS @@ -52,7 +52,7 @@ sub new sub need_lock { 0;} -# Descriptions: log a new user +# Descriptions: show log files # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map # Return Value: none @@ -70,7 +70,7 @@ sub process } -# Descriptions: log a new user +# Descriptions: show cgi menu # Arguments: OBJ($self) OBJ($curproc) HASH_REF($command_args) # Side Effects: update $member_map $recipient_map # Return Value: none @@ -86,6 +86,10 @@ sub cgi_menu } +# Descriptions: show log file +# Arguments: STR($log_file) HASH_REF($args) +# Side Effects: none +# Return Value: none sub _show_log { my ($log_file, $args) = @_; @@ -106,6 +110,7 @@ sub _show_log my $s = ''; $maxline -= $last_n_lines; + # show the last $last_n_lines lines by default. LINE: while (<$fh>) { next LINE if $linecount++ < $maxline; @@ -113,11 +118,7 @@ sub _show_log $s = STR2EUC($_); if ($is_cgi) { - $s =~ s/&/&/g; - $s =~ s/</</g; - $s =~ s/>/>/g; - $s =~ s/\"/"/g; - print $s; + print _html_to_text($s); print "<BR>\n"; } else { @@ -129,6 +130,26 @@ sub _show_log } +# Descriptions: convert text to html +# Arguments: STR($str) +# Side Effects: none +# Return Value: STR +sub _html_to_text +{ + my ($str) = @_; + + eval q{ + use HTML::FromText; + }; + unless ($@) { + return text2html($str, urls => 1, pre => 1); + } + else { + croak($@); + } +} + + =head1 AUTHOR Ken'ichi Fukamachi |
