Stop Data::Compare from loading plugins at will
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / ResultSet.pm
index bf4b1d8..aaff394 100644 (file)
@@ -8,7 +8,7 @@ use DBIx::Class::Exception;
 use DBIx::Class::ResultSetColumn;
 use Scalar::Util qw/blessed weaken/;
 use Try::Tiny;
-use Data::Compare;
+use Data::Compare (); # no imports!!! guard against insane architecture
 
 # not importing first() as it will clash with our own method
 use List::Util ();
@@ -569,7 +569,7 @@ sub _stack_cond {
     for (grep { exists $right->{$_} } keys %$left) {
       # the use of eq_deeply here is justified - the rhs of an
       # expression can contain a lot of twisted weird stuff
-      delete $right->{$_} if Compare( $left->{$_}, $right->{$_} );
+      delete $right->{$_} if Data::Compare::Compare( $left->{$_}, $right->{$_} );
     }
 
     $right = undef unless keys %$right;
@@ -1972,6 +1972,8 @@ sub populate {
   # cruft placed in standalone method
   my $data = $self->_normalize_populate_args(@_);
 
+  return unless @$data;
+
   if(defined wantarray) {
     my @created;
     foreach my $item (@$data) {
@@ -2076,7 +2078,10 @@ sub _normalize_populate_args {
   my ($self, $arg) = @_;
 
   if (ref $arg eq 'ARRAY') {
-    if (ref $arg->[0] eq 'HASH') {
+    if (!@$arg) {
+      return [];
+    }
+    elsif (ref $arg->[0] eq 'HASH') {
       return $arg;
     }
     elsif (ref $arg->[0] eq 'ARRAY') {