From: John Napiorkowski Date: Fri, 18 Feb 2011 14:06:21 +0000 (-0500) Subject: let you specific config as a perlref X-Git-Tag: 1.001011~7 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=13ff76330c4fd90b273904cd46c5bb47b268f0c0;p=dbsrgits%2FDBIx-Class-Fixtures.git let you specific config as a perlref --- diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index 4f995b9..92ac222 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -466,7 +466,12 @@ directory. For example: /home/me/app/fixtures/artist/3.fix /home/me/app/fixtures/producer/5.fix -schema and directory are required attributes. also, one of config or all must be specified. +schema and directory are required attributes. also, one of config or all must +be specified. + +Lastly, the C parameter can be a Perl HashRef instead of a file name. +If this form is used your HashRef should conform to the structure rules defined +for the JSON representations. =cut @@ -491,9 +496,13 @@ sub dump { my $schema = $params->{schema}; my $config; if ($params->{config}) { - #read config - my $config_file = $self->config_dir->file($params->{config}); - $config = $self->load_config_file($config_file); + my $config = ref $params->{config} eq 'HASH' ? + $params->{config} : + do { + #read config + my $config_file = $self->config_dir->file($params->{config}); + $self->load_config_file($config_file); + }; } elsif ($params->{all}) { my %excludes = map {$_=>1} @{$params->{excludes}||[]}; $config = {