Hi Tobi, On Thu, Apr 09, 2009 at 05:47:58PM +0200, Tobias Oetiker wrote: > Yesterday Sebastian Harl wrote: > > On Wed, Apr 08, 2009 at 07:32:38AM +0200, Tobias Oetiker wrote: > > > Otherwhise the solution is simple, update the docs and mention > > > that it does NOT work and if someone is so minded, update RRDp to > > > support graphv > > > > Well, that's basically what I proposed initially - I would have gone for > > reporting an error if "graph -" is used in RRDp::cmd though. When I was > > asking for someone to provide a patch, I had support for graphv in mind. > > Sorry, if that wasn't clear in the first place. Anyway, those two > > changes would be a perfectly valid solution for this problem imho. > > well for the moment the check for a call to graph - sounds like a > simple enough thing todo ... will create a patch and send it your > way ...
Well, that's trivial ... ;-) I've attached a patch to take care of that. Anyway, you've talked about "enhancing RRDp accordingly" - what did you have in mind then? None of the other commands is handled specifically ... Also, I noticed that graphv isn't documented yet. Having RRDp point to some undocumented feature is not very nice imho. Would you mind providing a manpage for that? TIA, Sebastian PS: I found the following piece of code in RRDp.pm: if ($Sequence ne 'S') { } What's that supposed to do? ;-) -- Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/ Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
diff a/program/bindings/perl-piped/RRDp.pm b/program/bindings/perl-piped/RRDp.pm --- a/program/bindings/perl-piped/RRDp.pm +++ b/program/bindings/perl-piped/RRDp.pm @@ -45,6 +45,9 @@ start RRDtool. The argument must be the path to the RRDtool executable pass commands on to RRDtool. check the RRDtool documentation for more info on the RRDtool commands. +B<Note>: Due to design limitations, B<RRDp::cmd> does not support the +C<graph -> command - use C<graphv -> instead. + =item $answer = B<RRDp::read> read RRDtool's response to your command. Note that the $answer variable will @@ -187,6 +190,13 @@ sub cmd (@){ } $cmd =~ s/\n/ /gs; $cmd =~ s/\s/ /gs; + + # The generated graphs aren't necessarily terminated by a newline, + # causing RRDp::read() to wait for a line matching '^OK' forever. + if ($cmd =~ m/^\s*graph\s+-\s+/) { + croak "RRDp does not support the 'graph -' command - " + . "use 'graphv -' instead"; + } print RRDwriteHand "$cmd\n"; }
signature.asc
Description: Digital signature