error zero division: more information

Francis J. Lacoste flacoste at logreport.org
Thu Mar 27 23:00:42 CET 2003


On jeu, 2003-03-27 at 14:07, Lire wrote:
> hi again:
> 
>  ok, come on with info:
> 
>     - i use the 1.2.1 version of lire. i got the rpm for linux and the installation was ok.
> 
>     - the problem happening with a report specification that i wrote. i wrote a ldap superservice for OpenLDAP
>     log. most probably the error was into my specification.
> 
[...]

The problem wasn't in your code at all. You found a bug in Lire.
Congratulations!

I'm attaching to this message a patch to Lire::AsciiDlf::GroupOp which
fixes the problem.

You should be able to apply that patch using -p0 in the top-level
directory of the extracted source or using -p4 directly on the
file.

Many users asked for OpenLdap support, do you think it would be possible
for you to contribute your DLF converter to Lire? We accept code
contribution on any terms compatible with the GPL. 

Thanks again for reporting that error and best regards


Francis J. Lacoste

-- 
Francis J. Lacoste              . .           http://www.logreport.org
/^LogReport$/               . .               flacoste at logreport.org
-------------- next part --------------
--- all/lib/Lire/AsciiDlf/GroupOp.pm.bak	2002-11-10 17:18:07.000000000 -0500
+++ all/lib/Lire/AsciiDlf/GroupOp.pm	2003-03-27 16:56:31.000000000 -0500
@@ -283,7 +283,7 @@
 	my $container = $ratio_spec eq 'table' ? $group->parent_entry->subreport :
 	  $group->parent_entry->group;
 	my $total = $container->get_summary_value( $self->name );
-	$content = sprintf '%.1f', ($value / $total->{value} * 100);
+	$content = $total->{value} ? sprintf('%.1f', $value / $total->{value} * 100) : "NaN";
     }
 
     $group->set_summary_value( $self->name, $content, $value )
@@ -450,7 +450,7 @@
 	my $container = $ratio_spec eq 'table' ? $group->parent_entry->subreport :
 	  $group->parent_entry->group;
 	my $total = $container->get_summary_value( $self->name );
-	$content = sprintf '%.1f', ($value / $total->{value} * 100);
+	$content = $total->{value} ? sprintf('%.1f', $value / $total->{value} * 100) : "NaN";
     }
 
     $group->set_summary_value( $self->name, $content, $value )
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.logreport.org/pipermail/development/attachments/20030327/8cc3270e/attachment.bin 


More information about the Development mailing list