On Sun, 12 Jun 2005, Sam Tregar wrote:

> So the question is, what is assigning an empty array to {Path}?

Of course right after sending the message I figured it out.
DBI::ProfileDumper was assuming that $profile->{Path} would always
contain an array-ref and it was auto-vivifying that hash when
$profile->{Path} contained undef!  I've attached a patch which fixes
the problem.

-sam

--- DBI-1.48/lib/DBI/ProfileDumper.pm   2004-12-16 11:40:25.000000000 -0500
+++ DBI-1.48.new/lib/DBI/ProfileDumper.pm       2005-06-12 02:11:22.465378504 
-0400
@@ -210,15 +210,17 @@
 
     # print out Path
     my @path_words;
-    foreach (@{$self->{Path}}) {
-        if ($_ eq DBI::Profile::DBIprofile_Statement) {
-            push @path_words, "DBIprofile_Statement";
-        } elsif ($_ eq DBI::Profile::DBIprofile_MethodName) {
-            push @path_words, "DBIprofile_MethodName";
-        } elsif ($_ eq DBI::Profile::DBIprofile_MethodClass) {
-            push @path_words, "DBIprofile_MethodClass";
-        } else {
-            push @path_words, $_;
+    if ($self->{Path}) {
+        foreach (@{$self->{Path}}) {
+            if ($_ eq DBI::Profile::DBIprofile_Statement) {
+                push @path_words, "DBIprofile_Statement";
+            } elsif ($_ eq DBI::Profile::DBIprofile_MethodName) {
+                push @path_words, "DBIprofile_MethodName";
+            } elsif ($_ eq DBI::Profile::DBIprofile_MethodClass) {
+                push @path_words, "DBIprofile_MethodClass";
+            } else {
+                push @path_words, $_;
+            }
         }
     }
     print $fh "Path = [ ", join(', ', @path_words), " ]\n";

Reply via email to