[Dbix-class] cdbi::sweet pager issue (OT?)

Andy Grundman andy at hybridized.org
Thu Aug 18 22:41:16 CEST 2005


Wade.Stuart at fallon.com wrote:
> Sorry this may be off topic -- last I heard this was the mailing list for
> sweet issues too..
> 
> If you look below I am getting some unexpected results from the sweet page,
> I thought at first I was getting the abstract structure wrong but after
> tracing it looks like sweets pager may be horking the where clause..

Turns out this was a bug in SQL::Abstract.  I've sent the attached patch 
to Nate Wiger, and it'll be in 1.20.

Not really off-topic, this issue would affect DBIC too. :)

-Andy
-------------- next part --------------
diff -ur SQL-Abstract-1.19/lib/SQL/Abstract.pm SQL-Abstract-1.20/lib/SQL/Abstract.pm
--- SQL-Abstract-1.19/lib/SQL/Abstract.pm	2005-04-29 14:20:42.000000000 -0400
+++ SQL-Abstract-1.20/lib/SQL/Abstract.pm	2005-08-17 21:40:31.000000000 -0400
@@ -154,11 +154,13 @@
 }
 
 # Anon copies of arrays/hashes
+# Based on deep_copy example by merlyn
+# http://www.stonehenge.com/merlyn/UnixReview/col30.html
 sub _anoncopy {
     my $orig = shift;
-    return (ref $orig eq 'HASH' ) ? { %$orig }
-         : (ref $orig eq 'ARRAY') ? [ @$orig ]
-         : $orig;     # rest passthru ok
+    return (ref $orig eq 'HASH')  ? +{map { $_ => _anoncopy($orig->{$_}) } keys %$orig}
+         : (ref $orig eq 'ARRAY') ? [map _anoncopy($_), @$orig]
+         : $orig;
 }
 
 # Debug


More information about the Dbix-class mailing list