X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=1610eb11823ce43274bfa90a580b68964bce0119;hb=ed899df367fc90a6b30f1e17d0ea4e2bc2e094f6;hp=118496ecbbfdad4629e8ebe9cdbf45a0ae84fbc8;hpb=69a3916705dfcae6227bc744fdbb810d78ba2c45;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 118496e..1610eb1 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -607,6 +607,10 @@ of the resultset. sub single { my ($self, $where) = @_; + if(@_ > 2) { + $self->throw_exception('single() only takes search conditions, no attributes. You want ->search( $cond, $attrs )->single()'); + } + my $attrs = { %{$self->_resolved_attrs} }; if ($where) { if (defined $attrs->{where}) { @@ -1109,7 +1113,11 @@ is returned in list context. =cut sub all { - my ($self) = @_; + my $self = shift; + if(@_) { + $self->throw_exception("all() doesn't take any arguments, you probably wanted ->search(...)->all()"); + } + return @{ $self->get_cache } if $self->get_cache; my @obj; @@ -2242,7 +2250,7 @@ sub _resolved_attrs { if (my $prefetch = delete $attrs->{prefetch}) { $prefetch = $self->_merge_attr({}, $prefetch); my @pre_order; - my $seen = $attrs->{seen_join} || {}; + my $seen = { %{ $attrs->{seen_join} || {} } }; foreach my $p (ref $prefetch eq 'ARRAY' ? @$prefetch : ($prefetch)) { # bring joins back to level of current class my @prefetch = $source->resolve_prefetch( @@ -2398,8 +2406,12 @@ sub throw_exception { =head1 ATTRIBUTES -The resultset takes various attributes that modify its behavior. Here's an -overview of them: +Attributes are used to refine a ResultSet in various ways when +searching for data. They can be passed to any method which takes an +C<\%attrs> argument. See L, L, L, +L. + +These are in no particular order: =head2 order_by @@ -2492,7 +2504,7 @@ L but adds columns to the selection. =over 4 -Indicates additional column names for those added via L. +Indicates additional column names for those added via L. See L. =back