X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI.pm;h=6026cd4b6781ba529b5555bd90a3defe909b72e7;hb=6b5e61afda80696f56615aa1b66e6f65539c5be0;hp=abb253392ce8c5978c8e428dd4bd53685f673765;hpb=8fd069b9fbf5814f8186323a85e2e1bad6d6fc91;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index abb2533..6026cd4 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -112,6 +112,12 @@ mixed together: %extra_attributes, }]; + $connect_info_args = [{ + dbh_maker => sub { DBI->connect (...) }, + %dbi_attributes, + %extra_attributes, + }]; + This is particularly useful for L based applications, allowing the following config (L style): @@ -126,7 +132,8 @@ following config (L style): The C/C/C combination can be substituted by the -C key whose value is a coderef that returns the C<$dbh>. +C key whose value is a coderef that returns a connected +L =back @@ -418,9 +425,15 @@ sub connect_info { @args = (); if (my $code = delete $attrs{dbh_maker}) { @args = $code; - if (delete @attrs{qw/dsn user password/}) { - warn 'dsn/user/password ignored when dbh_maker coderef used in ' . - 'connect_info'; + + my @ignored = grep { delete $attrs{$_} } (qw/dsn user password/); + if (@ignored) { + carp sprintf ( + 'Attribute(s) %s in connect_info were ignored, as they can not be applied ' + . "to the result of 'dbh_maker'", + + join (', ', map { "'$_'" } (@ignored) ), + ); } } else {