[Orca-checkins] r359 - in trunk/orca: lib/Orca orca

Blair Zajac blair at orcaware.com
Tue Jun 22 21:35:47 PDT 2004


Author: blair
Date: Tue Jun 22 21:32:59 2004
New Revision: 359

Modified:
   trunk/orca/lib/Orca/Config.pm
   trunk/orca/lib/Orca/ImageFile.pm
   trunk/orca/lib/Orca/SourceFile.pm
   trunk/orca/orca/orca.pl.in
Log:
In the plot hash references created in Orca::Config, rename the
'creates' hash key which contains an array of Orca::ImageFile's to
'created_orca_images' because just by looking at the code, it's was
not clear what was created.  Even I forgot what was being created :)

* lib/Orca/Config.pm,
* lib/Orca/ImageFile.pm,
* lib/Orca/SourceFile.pm,
* orca/orca.pl.in,
  s/creates/created_orca_images/.


Modified: trunk/orca/lib/Orca/Config.pm
==============================================================================
--- trunk/orca/lib/Orca/Config.pm	(original)
+++ trunk/orca/lib/Orca/Config.pm	Tue Jun 22 21:32:59 2004
@@ -729,7 +729,7 @@
 
     # Create an array for each plot that will have a list of images that
     # were generated from this plot.
-    $plot->{creates} = [];
+    $plot->{created_orca_images} = [];
 
     # Set any optional plot parameters to '' if it isn't defined in
     # the configuration file.

Modified: trunk/orca/lib/Orca/ImageFile.pm
==============================================================================
--- trunk/orca/lib/Orca/ImageFile.pm	(original)
+++ trunk/orca/lib/Orca/ImageFile.pm	Tue Jun 22 21:32:59 2004
@@ -82,7 +82,7 @@
   $name = name_to_fsname($name, $max_length);
 
   # Create the paths to the html directory and subdirectories.
-  my $html_dir     = "$config_global{html_dir}/$subgroup_name";
+  my $html_dir = "$config_global{html_dir}/$subgroup_name";
 
   # Create the html_dir directories if necessary.
   unless (-d $html_dir) {
@@ -241,13 +241,12 @@
 
     # For those attributes of the new plot that are array references
     # and need to be indexed for the particular data being plotted,
-    # copy them over.  Skip the 'creates' attribute which is not used
-    # for plotting and skip the color attribute as the color is
-    # treated
-    # specially.
+    # copy them over.  Skip the 'created_orca_images' attribute which
+    # is not used for plotting and skip the color attribute as the
+    # color is treated specially.
     for my $attribute (keys %$new_plot_ref) {
       next if $attribute eq 'color';
-      next if $attribute eq 'creates';
+      next if $attribute eq 'created_orca_images';
       next unless UNIVERSAL::isa($new_plot_ref->{$attribute}, 'ARRAY');
       $existing_plot_ref->{$attribute}[$i] = $new_plot_ref->{$attribute}[$j];
     }

Modified: trunk/orca/lib/Orca/SourceFile.pm
==============================================================================
--- trunk/orca/lib/Orca/SourceFile.pm	(original)
+++ trunk/orca/lib/Orca/SourceFile.pm	Tue Jun 22 21:32:59 2004
@@ -257,24 +257,25 @@
 
 # XXX
 # Utility function make a deep clone one of the plots in the
-# config_plots array, except for the 'creates' hash key.  This should
-# really be a method for a single plot, but the plot is not an object
-# right now, so it doesn't have any methods that can be given to it.
+# config_plots array, except for the 'created_orca_images' hash key.
+# This should really be a method for a single plot, but the plot is
+# not an object right now, so it doesn't have any methods that can be
+# given to it.
 sub deep_clone_plot {
-  my $plot             = shift;
-  my $restore_creates  = shift;
+  my $plot                        = shift;
+  my $restore_created_orca_images = shift;
 
-  # Be careful not to make a deep copy of the 'creates' reference,
-  # since it can cause recursion.
-  my $creates          = delete $plot->{creates};
-  my $new_plot         = dclone($plot);
-  $plot->{creates}     = $creates;
-  if ($restore_creates) {
-    $new_plot->{creates} = $creates;
+  # Be careful not to make a deep copy of the 'created_orca_images'
+  # reference, since it can cause recursion.
+  my $created_orca_images      = delete $plot->{created_orca_images};
+  my $new_plot                 = dclone($plot);
+  $plot->{created_orca_images} = $created_orca_images;
+  if ($restore_created_orca_images) {
+    $new_plot->{created_orca_images} = $created_orca_images;
   }
 
   if (wantarray) {
-    ($new_plot, $creates);
+    ($new_plot, $created_orca_images);
   } else {
     $new_plot;
   }
@@ -518,12 +519,12 @@
       # caused the match.  Then create string form of the plot object
       # using Data::Dumper::Dumper and replace all of the $1, $2,
       # ... with what was matched in the first data source.
-      my $creates;
-      ($plot, $creates)    = deep_clone_plot($plot, 0);
+      my $created_orca_images;
+      ($plot, $created_orca_images) = deep_clone_plot($plot, 0);
       $plot->{data}[0][$regexp_element_index] = $column_description;
-      my $d                = Data::Dumper->Dump([$plot], [qw(plot)]);
-      $plot->{creates}     = $creates;
-      my $count            = 1;
+      my $d = Data::Dumper->Dump([$plot], [qw(plot)]);
+      $plot->{created_orca_images} = $created_orca_images;
+      my $count = 1;
       foreach my $match (@matches) {
         $d =~ s/\$$count/$match/mge;
         $d =~ s/\(.+\)/$match/mge;
@@ -795,7 +796,7 @@
                                     \@my_rrds);
       $image_files_ref->{hash}{$all_names_with_subgroup} = $image;
       push(@{$image_files_ref->{list}}, $image);
-      push(@{$config_plots[$old_i]{creates}}, $image);
+      push(@{$config_plots[$old_i]{created_orca_images}}, $image);
     }
 
     # Put into each RRD the images that are generated from it.

Modified: trunk/orca/orca/orca.pl.in
==============================================================================
--- trunk/orca/orca/orca.pl.in	(original)
+++ trunk/orca/orca/orca.pl.in	Tue Jun 22 21:32:59 2004
@@ -794,8 +794,8 @@
 
   # Go through all of the configured plots.
   foreach my $config_plot (@config_plots) {
-    my $plot_creates = $config_plot->{creates};
-    next unless @$plot_creates;
+    my $created_orca_images = $config_plot->{created_orca_images};
+    next unless @$created_orca_images;
 
     my $group_index = $config_plot->{source_index};
     my $group_name  = $config_groups_names[$group_index];
@@ -812,7 +812,7 @@
     # have the same legend name.
     my %image_legend_no_subgroup;
     my %same_legends_image_list;
-    foreach my $image (@$plot_creates) {
+    foreach my $image (@$created_orca_images) {
       my $legend_no_subgroup = replace_subgroup_name($image->plot_ref->{title},
                                                      '');
       $image_legend_no_subgroup{$image} = $legend_no_subgroup;



More information about the Orca-checkins mailing list