X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl-piped%2FRRDp.pm;h=0a28506c28fe8533a1d03a1746a5faa6105cb658;hb=e357fb7d089224a089b6b34699f592a29a20fd59;hp=83ffb600740724daa88ff564d7ce1efe24ff045d;hpb=2e6c98e893777e4abf7b05cb4ecf81dde088cdb8;p=rrdtool.git diff --git a/bindings/perl-piped/RRDp.pm b/bindings/perl-piped/RRDp.pm index 83ffb60..0a28506 100644 --- a/bindings/perl-piped/RRDp.pm +++ b/bindings/perl-piped/RRDp.pm @@ -120,7 +120,7 @@ sub cmd (@); sub end (); sub read (); -$VERSION=1.2019; +$VERSION=1.3001; sub start ($){ croak "rrdtool is already running" @@ -146,7 +146,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 +162,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"; }