Subject: | RRD::Simple update fails when value of single ds matches regexp for timestamp |
Date: | Thu, 14 Feb 2013 20:10:29 +0200 |
To: | bug-RRD-Simple [...] rt.cpan.org |
From: | Richard van Katwijk <richard [...] three6five.com> |
Hi,
The 'update' function fails when it is called with a single ds, and when
the value of the ds is a large integer, which could be mistaken for a
timestamp.
Example:
$rrd->update( 'packets'=>210188702);
fails with :
you must define at least one Data Source at <script>.pl line xxx
While
$rrd->update( 'packets'=>10188702);
succeeds.
This seems to be because the numeric portion of the regexp in RRD/Simple.pm
(~line 239)
} elsif (!(@_ % 2) && $_[1] =~ /^[1-9][0-9]{8,10}$/i) {
$rrdfile = shift;
matches the integer value as a timestamp and then (incorrectly) sets the
$rrdfile equal to the ds name.
The simple 'fix' is to insist that the $rrdfile be passed as the first
parameter to the 'update' call, so that the $ds=>$value specification is
never misinterpreted.
Kind regards,
Richard van Katwijk