summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2003-05-28 14:33:42 +0000
committerfukachan <fukachan>2003-05-28 14:33:42 +0000
commitabb03e0988c3a3df59546994ba1b5cd14aa67283 (patch)
tree9750a8f3141be24bd9bdb0412291232f59a03730
parentd542dd095de51d899027d425d0b596b914086b97 (diff)
downloadfml8-abb03e0988c3a3df59546994ba1b5cd14aa67283.tar.gz
fml8-abb03e0988c3a3df59546994ba1b5cd14aa67283.tar.bz2
fml8-abb03e0988c3a3df59546994ba1b5cd14aa67283.zip
move main part of print() to FML::Error::Analyzer::* modules.
So, print() format depends on FML::Error::Analyzer::* class.
-rw-r--r--fml/lib/FML/Error.pm19
-rw-r--r--fml/lib/FML/Error/Analyze.pm17
-rw-r--r--fml/lib/FML/Error/Analyze/histgram.pm26
-rw-r--r--fml/lib/FML/Error/Analyze/simple_count.pm16
4 files changed, 59 insertions, 19 deletions
diff --git a/fml/lib/FML/Error.pm b/fml/lib/FML/Error.pm
index 01a79f4f..8f4c2334 100644
--- a/fml/lib/FML/Error.pm
+++ b/fml/lib/FML/Error.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: Error.pm,v 1.21 2003/05/20 13:49:04 fukachan Exp $
+# $FML: Error.pm,v 1.22 2003/05/28 13:14:04 fukachan Exp $
#
package FML::Error;
@@ -457,21 +457,8 @@ sub print
if (defined $analyzer) {
my $info = $analyzer->summary();
- my ($k, $v);
-
- while (($k, $v) = each %$info) {
- if (defined($v) && ref($v) eq 'ARRAY') {
- my $x = '';
- for my $y (@$v) {
- $x .= $y if defined $y;
- $x .= " ";
- }
-
- printf $wh "%25s => (%s)\n", $k, $x;
- }
- else {
- printf $wh "%25s => %s\n", $k, $v;
- }
+ for my $k (keys %$info) {
+ $analyzer->print($k);
}
}
}
diff --git a/fml/lib/FML/Error/Analyze.pm b/fml/lib/FML/Error/Analyze.pm
index eb4f12f0..594e2cac 100644
--- a/fml/lib/FML/Error/Analyze.pm
+++ b/fml/lib/FML/Error/Analyze.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: Analyze.pm,v 1.19 2003/02/09 12:31:42 fukachan Exp $
+# $FML: Analyze.pm,v 1.20 2003/05/28 13:14:05 fukachan Exp $
#
package FML::Error::Analyze;
@@ -99,6 +99,21 @@ sub removal_address
}
+# Descriptions: print address and the status summary.
+# Arguments: OBJ($self) STR($addr)
+# Side Effects: none
+# Return Value: none
+sub print
+{
+ my ($self, $addr) = @_;
+ my $analyzer = $self->{ _analyzer };
+
+ if (defined $analyzer) {
+ return $analyzer->print($addr);
+ }
+}
+
+
=head2 C<AUTOLOAD()>
the command dispatcher.
diff --git a/fml/lib/FML/Error/Analyze/histgram.pm b/fml/lib/FML/Error/Analyze/histgram.pm
index 46352a09..dc63ec1e 100644
--- a/fml/lib/FML/Error/Analyze/histgram.pm
+++ b/fml/lib/FML/Error/Analyze/histgram.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: @template.pm,v 1.7 2003/01/01 02:06:22 fukachan Exp $
+# $FML: histgram.pm,v 1.1 2003/05/28 13:14:05 fukachan Exp $
#
package FML::Error::Analyze::histgram;
@@ -206,6 +206,30 @@ sub removal_address
}
+# Descriptions: print address and the summary
+# Arguments: OBJ($self) STR($addr)
+# Side Effects: none
+# Return Value: none
+sub print
+{
+ my ($self, $addr) = @_;
+ my $wh = \*STDOUT;
+ my $summary = $self->summary();
+ my $bufarray = $summary->{ $addr } || [];
+ my $x = '';
+ my $y = '';
+
+ for my $y (@$bufarray) {
+ $x .= defined $y ? $y : 0;
+ $x .= " ";
+ }
+
+ $x =~ s/^\s*//;
+ $x =~ s/\s*$//;
+ printf $wh "%25s => (%s)\n", $addr, $x;
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.
diff --git a/fml/lib/FML/Error/Analyze/simple_count.pm b/fml/lib/FML/Error/Analyze/simple_count.pm
index 7624d08b..47289bd5 100644
--- a/fml/lib/FML/Error/Analyze/simple_count.pm
+++ b/fml/lib/FML/Error/Analyze/simple_count.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: @template.pm,v 1.7 2003/01/01 02:06:22 fukachan Exp $
+# $FML: simple_count.pm,v 1.1 2003/05/28 13:14:05 fukachan Exp $
#
package FML::Error::Analyze::simple_count;
@@ -139,6 +139,20 @@ sub removal_address
}
+# Descriptions: print address and the summary
+# Arguments: OBJ($self) STR($addr)
+# Side Effects: none
+# Return Value: none
+sub print
+{
+ my ($self, $addr) = @_;
+ my $wh = \*STDOUT;
+ my $summary = $self->summary();
+
+ printf $wh "%25s => %s\n", $addr, $summary->{ $addr };
+}
+
+
=head1 CODING STYLE
See C<http://www.fml.org/software/FNF/> on fml coding style guide.