in reply to Re^2: implicit numeric conversion isn't
in thread implicit numeric conversion isn't

Neither of those variables that Dump() has displayed would cause the error you see. It would be fine to use either of those 2 with the modulus operator.

Somehow, your program is seeing some other value that equates to (or is) zero. (Are warnings enabled ?)

What's happening between  my $step = $hash->{'step'}; and my $mid = $lupdate % $step ; in your code ?

Cheers,
Rob

Replies are listed 'Best First'.
Re^4: implicit numeric conversion isn't
by stargrazer (Novice) on Nov 25, 2006 at 01:11 UTC
    Here is a traceback:
    error:  Illegal modulus zero at /var/www/distats.html line 187.
     
    context:  ...   
    183:   
    184:  my $hash = RRDs::info( $datafile ); 
    185:  my $hStep = $hash->{'step'}; 
    186:  my $lupdate = $hash->{'last_update'}; 
    187:  my $mid = $lupdate % $hStep; 
    188:  print( "$lupdate % $hStep = $mid\n" ); 
    189:  $m->print( " ** lu=$lupdate, step=$hStep ref '" . ref($hStep) . "'\n" ); 
    190:  Dump $hStep; 
    191:  $hStep='301'; 
    ...   
     
    code stack:  /var/www/distats.html:187
    /usr/share/cricket/lib/ConfigTree/Cache.pm:93
    /usr/share/cricket/lib/ConfigTree/Cache.pm:90
    /var/www/distats.html:18
    /var/www/_content:13
    /var/www/autohandler:40 
    
    I have elsewhere above my code:
    use strict;
    use warnings;
    
    One other factoid is that this is using Mason. Which shouldn't get in the way. I also have some Cricket includes as well, which you can see this is the result of a Cricket call back. Well... I guess this is where I strip out all the other code bits and just put this one bit of code in and see what happens.