Skip to content

Commit

Permalink
[RT 54544] Tom Regner added support for updatev().
Browse files Browse the repository at this point in the history
  • Loading branch information
mschilli committed Feb 21, 2010
1 parent 1a9e10c commit 5b99cfa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Changes
@@ -1,6 +1,7 @@
0.29 (not yet released)
0.29 (02/20/2010)
(ms) Added github repository link to Makefile.PL
(ms) Fixed documentation for fetch_next().
(ms) [RT 54544] Tom Regner added support for updatev().

0.28 (11/05/2009)
(ms) Applied patch by Lyle Brooks, adding optional step, start, and
Expand Down
30 changes: 27 additions & 3 deletions lib/RRDTool/OO.pm
Expand Up @@ -7,7 +7,7 @@ use Carp;
use RRDs;
use Log::Log4perl qw(:easy);

our $VERSION = '0.28';
our $VERSION = '0.29';

# Define the mandatory and optional parameters for every method.
our $OPTIONS = {
Expand Down Expand Up @@ -142,6 +142,7 @@ my %RRDs_functions = (
create => \&RRDs::create,
fetch => \&RRDs::fetch,
update => \&RRDs::update,
updatev => \&RRDs::updatev,
graph => \&RRDs::graph,
graphv => \&RRDs::graphv,
info => \&RRDs::info,
Expand Down Expand Up @@ -480,8 +481,25 @@ sub update {
$update_string .= $options_hash{value};
}

$self->RRDs_execute("update", $self->{file},
@update_options, $update_string);
my $caller = (caller(1))[3] ? (caller(1))[3] : '';
my $updatecmd = $caller eq __PACKAGE__."::updatev" ? 'updatev' : 'update';
my ($print_results) =
$self->RRDs_execute($updatecmd, $self->{file},
@update_options, $update_string);

if(!defined $print_results) {
return undef;
}

$self->print_results( $print_results );

return 1;
}

#################################################
sub updatev {
#################################################
&update (@_);
}

#################################################
Expand Down Expand Up @@ -1341,6 +1359,12 @@ names to values:
C<RRDTool::OO> will transform this automagically
into C<RRDTool's> I<template> syntax.
=item I<$rrd-E<gt>updatev( ... )>
This is identical to C<update>, but uses rrdtool's updatev function internally.
The only difference is when using the C<print_results> method described
below, which then contains additional information.
=item I<$rrd-E<gt>fetch_start( ... )>
Initializes the iterator to fetch data from the RRD. This works nicely without
Expand Down

0 comments on commit 5b99cfa

Please sign in to comment.