X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=bindings%2Fperl-piped%2FRRDp.pm;h=7419cc7b4bbd816b11a6a8fa386a86157533196e;hb=daf8e7ff715a59e1f9827080d1b785ffb3c5a4b1;hp=b4e1a1b9d10c6c683bc54720cdefd843f04206b9;hpb=a9e69acbc184063dcc0eda6a250ee1b7ae1cbb47;p=rrdtool.git diff --git a/bindings/perl-piped/RRDp.pm b/bindings/perl-piped/RRDp.pm index b4e1a1b..7419cc7 100644 --- a/bindings/perl-piped/RRDp.pm +++ b/bindings/perl-piped/RRDp.pm @@ -99,7 +99,7 @@ For more information on how to use RRDtool, check the manpages. =head1 AUTHOR -Tobias Oetiker +Tobias Oetiker =cut #' this is to make cperl.el happy @@ -120,7 +120,7 @@ sub cmd (@); sub end (); sub read (); -$VERSION=1.2013; +$VERSION=1.299908053100; 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"; }