The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 05
MANIFEST 01
META.json 23
META.yml 12
MYMETA.json 23
MYMETA.yml 12
Makefile.PL 01
README 11
lib/RRDTool/OO.pm 25
t/013Clone.t 059
10 files changed (This is a version diff) 982
@@ -1,3 +1,8 @@
+0.33  (07/08/2013)
+    (ms) Florian Eckert reported that graph() modified 2nd level
+         entries of the options array passed to it. Used Storable::clone
+         in OO.pm to make a deep copy first.
+
 0.32  (03/06/2012)
     (ms) [rt.cpan.org #63351] Applied modified patch by Jonas Wagner to
          fix stacked graphs with no legend.
@@ -22,4 +22,5 @@ t/009Dry.t
 t/010ABD.t
 t/011Bugs.t
 t/012Xport.t
+t/013Clone.t
 META.json                                Module JSON meta-data (added by MakeMaker)
@@ -33,7 +33,8 @@
       "runtime" : {
          "requires" : {
             "Log::Log4perl" : "0.40",
-            "RRDs" : "0"
+            "RRDs" : "0",
+            "Storable" : "0"
          }
       }
    },
@@ -43,5 +44,5 @@
          "url" : "http://github.com/mschilli/rrdtool-oo-perl"
       }
    },
-   "version" : "0.32"
+   "version" : "0.33"
 }
@@ -20,6 +20,7 @@ no_index:
 requires:
   Log::Log4perl: 0.40
   RRDs: 0
+  Storable: 0
 resources:
   repository: http://github.com/mschilli/rrdtool-oo-perl
-version: 0.32
+version: 0.33
@@ -33,7 +33,8 @@
       "runtime" : {
          "requires" : {
             "Log::Log4perl" : "0.40",
-            "RRDs" : "0"
+            "RRDs" : "0",
+            "Storable" : "0"
          }
       }
    },
@@ -43,5 +44,5 @@
          "url" : "http://github.com/mschilli/rrdtool-oo-perl"
       }
    },
-   "version" : "0.32"
+   "version" : "0.33"
 }
@@ -20,6 +20,7 @@ no_index:
 requires:
   Log::Log4perl: 0.40
   RRDs: 0
+  Storable: 0
 resources:
   repository: http://github.com/mschilli/rrdtool-oo-perl
-version: 0.32
+version: 0.33
@@ -57,6 +57,7 @@ WriteMakefile(
     PREREQ_PM         => {
                          Log::Log4perl => '0.40',
                          RRDs          => 0,
+                         Storable      => 0,
                          }, # e.g., Module::Name => 1.1
     $ExtUtils::MakeMaker::VERSION >= 6.50 ? (%$meta_merge) : (),
     ($] >= 5.005 ?     ## Add these new keywords supported since 5.005
@@ -1,5 +1,5 @@
 ######################################################################
-    RRDTool::OO 0.32
+    RRDTool::OO 0.33
 ######################################################################
 
 NAME
@@ -5,10 +5,11 @@ use strict;
 use warnings;
 use Carp;
 use RRDs;
+use Storable;
 use Data::Dumper;
 use Log::Log4perl qw(:easy);
 
-our $VERSION = '0.32';
+our $VERSION = '0.33';
 
    # Define the mandatory and optional parameters for every method.
 our $OPTIONS = {
@@ -635,7 +636,9 @@ sub error_message {
 #################################################
 sub graph {
 #################################################
-    my($self, @options) = @_;
+    my($self, @params) = @_;
+
+    my @options = @{ Storable::dclone( \@params ) };
 
     my @trailing_options = ();
 
@@ -0,0 +1,59 @@
+
+use Test::More;
+use RRDTool::OO;
+use Log::Log4perl qw(:easy);
+
+my $rrd = RRDTool::OO->new( file => "blech.rrd" );
+
+plan tests => 1;
+
+my $start_time     = 1080460200;
+my $nof_iterations = 40;
+my $end_time       = $start_time + $nof_iterations * 60;
+
+my $rc = $rrd->create(
+    start     => $start_time - 10,
+    step      => 60,
+    data_source => { name      => 'load1',
+                     type      => 'GAUGE',
+                     heartbeat => 90,
+                     min       => 0,
+                     max       => 10.0,
+                   },
+    archive     => { cfunc    => 'MAX',
+                     xff      => '0.5',
+                     cpoints  => 1,
+                     rows     => 5,
+                   },
+);
+
+my %options = (
+      image          => "mygraph.png",
+      vertical_label => 'Test vdef, gprint',
+      width          => 1000,
+      start          => 0,
+      end            => 1,
+      draw           => {
+        type      => 'hidden',
+        dsname    => 'tx',
+        cfunc     => 'MAX',
+        name      => 'tx_max',
+      },
+      gprint      => {
+          'draw'      => 'tx_max',
+          'format'    => 'AVERAGE:%5.1lf%s Avg,',
+      },
+);
+
+eval { 
+    $rrd->graphv( %options );
+};
+
+  # Don't modify the incoming array (bug reported by Florian Eckert)
+ok !exists $options{ draw }->{ file }, 
+  "no in-depth modification of input array";
+
+# use Data::Dumper;
+# print Dumper( \@options );
+
+END { unlink "blech.rrd"; }