[Orca-users] Re: Error: Use of uninitialized value in array ...

Blair Zajac blair at akamai.com
Mon Feb 5 12:27:26 PST 2001


The problem turns out to be in the input data filename sorting code.
To save memory Orca internally refers to all input data files by a
unique file ID and only when the filename is required, for opening the
file or for printing messages, does the filename get retrieved by
indexing into an array.  There is also a hash that can be keyed by the
filename to get the file ID.

In any case, Orca will sort the filenames using a subroutine that is
eval'ed in the Orca::Config module using either the subroutine
specified in the configuration file or a default sorting subroutine.
The subroutine takes the file ID and compares the filenames by
indexing an array with the file ID.

The problem was that the subroutine was eval'ed in Orca::Config while
the sort was being performed in the main package and the $a and $b
that the compare subroutine expected were not being set.

This problem is probably responsible for problems where there are
missing data from the plots.  Since the filename sort tells Orca the
order in which to load data into the RRD files and the sort will have
newer data files listed before older data files, once newer data is
entered into an RRD file you cannot add older data resulting in
missing data in the output plots.  The solution to this is to remove
the RRD files and rerun Orca with all of the input data files.

The attached patch fixes this for Orca 0.26.

Regards,
Blair
-------------- next part --------------
--- ../orca-0.26/src/orca.pl.in	Thu Mar  9 14:49:59 2000
+++ src/orca.pl.in	Mon Feb  5 11:19:09 2001
@@ -965,17 +965,23 @@
 
     # Create a new list of filenames sorted by subgroup name and
     # inside each subgroup sorted using the filename_compare
-    # configuration option function or by the Perl cmp function.  This
-    # will cause the created plots to appear in subgroup order.  The
-    # compare subroutine expects the input in the $a and $b package
-    # variables.  Since the subroutine was eval'ed in the Orca::Config
-    # package, the sort subroutine needs be in that package.
+    # configuration file function or by the default compare function
+    # that uses cmp to compare filenames.  This will cause the created
+    # plots to appear in subgroup order.  Note that the FIDs are not
+    # being sorted, but the filename the FID references.
+    #
+    # The compare subroutine expects the input in the $a and $b
+    # package variables and since the compare subroutine was eval'ed
+    # in the Orca::Config package, the compare subroutine needs be run
+    # in Orca::Config.  Also, since sort cannot be passed a reference
+    # to a sorting subroutine stored in a hash (i.e. sort $a{b} @c),
+    # use a temporary variable.
     @fids = ();
     {
-      local *Orca::Config::fc = $config_groups{$group_name}{filename_compare};
+      package Orca::Config;
+      my $fc = $config_groups{$group_name}{filename_compare};
       foreach my $subgroup (sort keys %tmp_fids_by_subgroup) {
-        push(@fids,
-             sort Orca::Config::fc @{$tmp_fids_by_subgroup{$subgroup}});
+        push(@fids, sort $fc @{$tmp_fids_by_subgroup{$subgroup}});
       }
     }
 


More information about the Orca-users mailing list