What does this error means - Illegal modulus zero at ./mailboxes-lib.pl line 477 ?

Discussion in 'Programming' started by linuxunix, Mar 30, 2007.

  1. #1
    Does any one knows what this error means?
    Illegal modulus zero at ./mailboxes-lib.pl line 477

    Thanks.
     
    linuxunix, Mar 30, 2007 IP
  2. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    It would be helpful to post line 477 but without it (and not having done Perl for a long time) I think it would be safe to assume that you're either doing a modulo call (x % y) or doing a division (x / y) where y is 0.

    You should probably test that it's not zero before doing the calculation.
     
    TwistMyArm, Mar 30, 2007 IP
  3. ccoonen

    ccoonen Well-Known Member

    Messages:
    1,606
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Yup, modulus just gets the remainder when you divide by something - probably either devided by zero, or trying to mathematical calls with non-numeric values.
     
    ccoonen, Mar 30, 2007 IP
  4. linuxunix

    linuxunix Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I didn't program any perl scripts.

    I use webmin as the web interface to view the services in the server. I get this error when i click to view the mailboxes in the qmail window.

    The complete error shoes -

    User mailboxes
    HTTP/1.0 500 Perl execution failed Server: MiniServ/0.01 Date: Sat, 31 Mar 2007 22:30:47 GMT Content-type: text/html Connection: close
    Error - Perl execution failed

    Illegal modulus zero at ./mailboxes-lib.pl line 477.
     
    linuxunix, Mar 31, 2007 IP
  5. linuxunix

    linuxunix Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    mailboxes-lib.pl

    line 471 else {
    line 472 # Just showing username (and maybe size)
    line 473 print &ui_table_start($text{'index_header'}, "width=100%", $config{'column_count'});
    line 474 local $i = 0;
    line 475 foreach $u (@users) {
    line 476 next if($config{'ignore_users_enabled'} == 1 && $config{'ignore_users'} =~ /$u->[0]/);
    line 477 print "<tr>\n" if ($i % $config{'column_count'} == 0);
    line 478 print "<td width=", int(100/$config{'column_count'}), "%><a href='list_mail.cgi?user=$u->[0]'>";
    line 479 print $u->[0];
    line 480 if ($config{'show_size'} == 1) {
    line 481 local @folders = &list_user_folders(@$u);
    line 482 local $total = &folder_size(@folders);
    line 483 if ($size{$u->[0]} > 0) {
     
    linuxunix, Mar 31, 2007 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I haven't done Perl in a long time, but if you changed:
    
    print "<tr>\n" if ($i % $config{'column_count'} == 0);
    
    Code (markup):
    to:
    
    print "<tr>\n" if (($config{'column_count'} == 0) || ($i % $config{'column_count'} == 0));
    
    Code (markup):
    I think you should be right. Or, alternatively, look at your config and work out why 'column_count' is zero...
     
    TwistMyArm, Mar 31, 2007 IP
  7. linuxunix

    linuxunix Peon

    Messages:
    16
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thanks for the quick reply i would post the results when i have done it. Thanks.
     
    linuxunix, Mar 31, 2007 IP