X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FRetrieve.pm;h=3259bb25b63ae83e9d78a1685bc6dc9d90e61369;hb=8292706e66edd1a95b3af7796aa013285fc842ef;hp=58a39d4dc19c8cf1dc2f8bb9629ba72a5d2d2dac;hpb=19e3ec11e0527341c483fff1a79b7f16dc6e15c2;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index 58a39d4..3259bb2 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -3,11 +3,20 @@ package DBIx::Class::CDBICompat::Retrieve; use strict; use warnings FATAL => 'all'; -sub retrieve { shift->find(@_) } -sub retrieve_all { shift->search_literal('1', @_) } -sub retrieve_from_sql { shift->search_literal(@_) } -sub count_all { shift->count_literal('1') } +sub retrieve { + die "No args to retrieve" unless @_ > 1; + shift->find(@_); +} + +sub retrieve_from_sql { + my ($class, $cond, @rest) = @_; + $cond =~ s/^\s*WHERE//i; + $class->search_literal($cond, @rest); +} + +sub retrieve_all { shift->search } +sub count_all { shift->count } # Contributed by Numa. No test for this though. 1;