in reply to implicit numeric conversion isn't

It shouldn't be taint; taint is checked for system calls, but not for simple operations like modulus.

It does work okay here (RHEL 3, perl 5.8.0).

When I run it as follows:

use strict; use warnings; use RRDs; my $datafile = "temp.rrd"; my $lupdate = 12345; my $hash = RRDs::info($datafile); my $step = $hash->{'step'}; my $mid = $lupdate % $step; print $mid;
... it prints 45 as expected.

Possibly the error is elsewhere in your code...?

Replies are listed 'Best First'.
Re^2: implicit numeric conversion isn't
by stargrazer (Novice) on Nov 25, 2006 at 00:53 UTC
    Try it this way (get last update from the hash as well):
      my $hash    = RRDs::info( $datafile );
      my $hStep   = $hash->{'step'};
      my $lupdate = $hash->{'last_update'};
      my $mid     = $lupdate % $hStep;
      print( "$lupdate % $hStep = $mid\n" );
    
      That works here, too. It prints (at the moment) 187.   Devel::Peek shows both $hStep and $lupdate are integers (IOK set):
      SV = IV(0x9f83208) at 0x9ee8b6c
        REFCNT = 1
        FLAGS = (PADBUSY,PADMY,IOK,pIOK)
        IV = 300
      SV = IV(0x9f8320c) at 0x9ee8b78
        REFCNT = 1
        FLAGS = (PADBUSY,PADMY,IOK,pIOK)
        IV = 1163531587
      
        Thank you for trying. I split out my code, and it works as expected. Therefore something is happening earlier in the code, perhaps somewhere before or during the call to the Cricket libraries, which call this code as a referenced subroutine.