X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=25fda373af4b8067e7d2b4604dc95d43a5aba850;hb=6515609bb769fc957052afa939d725d7a8f819f7;hp=6ac8538a664ef48a167ec95d7ca9a046ebea4271;hpb=52b420dd006f55aced42c669f49182890b8826ea;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 6ac8538..25fda37 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -9,6 +9,8 @@ use DBIx::Class::ResultSourceHandle; use DBIx::Class::Exception; use Carp::Clan qw/^DBIx::Class/; use Try::Tiny; +use List::Util 'first'; +use namespace::clean; use base qw/DBIx::Class/; @@ -143,7 +145,7 @@ by supplying an L in the column_info hash. If a column name beginning with a plus sign ('+col1') is provided, the attributes provided will be merged with any existing attributes for the column, with the new attributes taking precedence in the case that an -attribute already exists. Using this without a hashref +attribute already exists. Using this without a hashref (C<< $source->add_columns(qw/+col1 +col2/) >>) is legal, but useless -- it does the same thing it would do without the plus. @@ -175,7 +177,7 @@ the name of the column will be used. This contains the column type. It is automatically filled if you use the L producer, or the -L module. +L module. Currently there is no standard set of values for the data_type. Use whatever your database supports. @@ -485,7 +487,7 @@ named C. Note: you normally do want to define a primary key on your sources B. See -L +L for more info. =cut @@ -590,14 +592,14 @@ sub add_unique_constraint { =over 4 -=item Arguments: @colnames +=item Arguments: \@colnames =item Return value: Constraint name =back $source->table('mytable'); - $source->name_unique_constraint('col1', 'col2'); + $source->name_unique_constraint(['col1', 'col2']); # returns 'mytable_col1_col2' @@ -899,7 +901,7 @@ clause contents. my $schema = $source->schema(); -Returns the L object that this result source +Returns the L object that this result source belongs to. =head2 storage @@ -1291,7 +1293,7 @@ sub _resolve_join { -is_single => ( $rel_info->{attrs}{accessor} && - List::Util::first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/) + first { $rel_info->{attrs}{accessor} eq $_ } (qw/single filter/) ), -alias => $as, -relation_chain_depth => $seen->{-relation_chain_depth} || 0, @@ -1478,7 +1480,7 @@ sub _resolve_prefetch { keys %{$rel_info->{cond}}; my @ord = (ref($rel_info->{attrs}{order_by}) eq 'ARRAY' ? @{$rel_info->{attrs}{order_by}} - + : (defined $rel_info->{attrs}{order_by} ? ($rel_info->{attrs}{order_by}) : ())); @@ -1536,7 +1538,7 @@ sub related_class { =head2 handle -Obtain a new handle to this source. Returns an instance of a +Obtain a new handle to this source. Returns an instance of a L. =cut