From: Drew Taylor Date: Mon, 19 May 2008 15:16:58 +0000 (+0000) Subject: Move post_ddl processing into separate method X-Git-Tag: v1.001002~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6a05e3811d4dabdb78d16ee1a3a4098e2b8c36ec;p=dbsrgits%2FDBIx-Class-Fixtures.git Move post_ddl processing into separate method --- diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index e0a1cb0..e85a545 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -853,14 +853,7 @@ sub populate { $rs->populate(\@rows); } - if ($params->{post_ddl}) { - my $data = _read_sql($params->{post_ddl}); - foreach (@$data) { - eval { $schema->storage->dbh->do($_) or warn "SQL was:\n $_"}; - if ($@) { die "SQL was:\n $_\n$@"; } - } - $self->msg("- finished importing post-populate DDL into DB"); - } + $self->do_post_ddl({schema=>$schema, post_ddl=>$params->{post_ddl}}) if $params->{post_ddl}; $self->msg("- fixtures imported"); $self->msg("- cleaning up"); @@ -870,6 +863,18 @@ sub populate { return 1; } +sub do_post_ddl { + my ($self, $params) = @_; + + my $schema = $params->{schema}; + my $data = _read_sql($params->{post_ddl}); + foreach (@$data) { + eval { $schema->storage->dbh->do($_) or warn "SQL was:\n $_"}; + if ($@) { die "SQL was:\n $_\n$@"; } + } + $self->msg("- finished importing post-populate DDL into DB"); +} + sub msg { my $self = shift; my $subject = shift || return;