X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl-piped%2FRRDp.pm;h=31e10438a786e03eca289dc1802fca4e83e364c4;hb=80b552c8c6b95a1dd68b3fb9e546561bbc2c0999;hp=e61a28be77cf659eb23eafaecc794f309d5c087c;hpb=5fc7ff89bdbced9c593c566fea9840a269935dcd;p=rrdtool.git diff --git a/bindings/perl-piped/RRDp.pm b/bindings/perl-piped/RRDp.pm index e61a28b..31e1043 100644 --- a/bindings/perl-piped/RRDp.pm +++ b/bindings/perl-piped/RRDp.pm @@ -102,6 +102,7 @@ For more information on how to use RRDtool, check the manpages. Tobias Oetiker =cut + #' this is to make cperl.el happy use strict; @@ -120,7 +121,7 @@ sub cmd (@); sub end (); sub read (); -$VERSION=1.2023; +$VERSION=1.3002; sub start ($){ croak "rrdtool is already running" @@ -146,7 +147,6 @@ sub read () { my $buffer; my $nfound; my $timeleft; - my $ERR = 0; vec($inmask,fileno(RRDreadHand),1) = 1; # setup select mask for Reader while (1) { my $rout; @@ -163,11 +163,14 @@ sub read () { $RRDp::error = undef; if ($line =~ m|^ERROR|) { $RRDp::error_mode eq 'catch' ? $RRDp::error = $line : croak $line; - $ERR = 1; + $RRDp::sys = undef; + $RRDp::user = undef; + $RRDp::real = undef; + return undef; } - elsif ($line =~ m|^OK u:([\d\.]+) s:([\d\.]+) r:([\d\.]+)|){ + elsif ($line =~ m|^OK(?: u:([\d\.]+) s:([\d\.]+) r:([\d\.]+))?|){ ($RRDp::sys,$RRDp::user,$RRDp::real)=($1,$2,$3); - return $ERR == 1 ? undef : \$buffer; + return \$buffer; } else { $buffer .= $line. "\n"; }