From: Luke Saunders Date: Mon, 28 Jul 2008 12:46:41 +0000 (+0000) Subject: doesn't populate if there's nothing to populate X-Git-Tag: v1.001002~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3ef08655141a5d70cfde537c0931995435a649d;p=dbsrgits%2FDBIx-Class-Fixtures.git doesn't populate if there's nothing to populate --- diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index 20120d8..983899d 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -498,6 +498,7 @@ sub dump { $config->{rules} ||= {}; my @sources = sort { $a->{class} cmp $b->{class} } @{delete $config->{sets}}; my %options = ( is_root => 1 ); + $self->{queue} = []; foreach my $source (@sources) { # apply rule to set if specified my $rule = $config->{rules}->{$source->{class}}; @@ -543,6 +544,10 @@ sub dump { } } + while (my $entry = shift @{$self->{queue}}) { + $self->dump_object(@$entry); + } + foreach my $dir ($output_dir->children) { next if ($dir eq $tmp_output_dir); $dir->remove || $dir->rmtree; @@ -864,7 +869,7 @@ sub populate { $HASH1 = $fixup_visitor->visit($HASH1) if $fixup_visitor; push(@rows, $HASH1); } - $rs->populate(\@rows); + $rs->populate(\@rows) if (scalar(@rows)); } });