I hate wantarray. It's a constant source of bugs and makes testing more complicated. I prefer methods that consistently return the same thing. my @foo = Bar->search(baz => 1) || die "no baz found"; That will not give the list context return, but rather the scalar return, which is an iterator in Class::DBI. This is just the tip of the iceberg.
I agree - although the context dependent return value is nice sometimes, it more often causes problems.
Yeah, that's basically why it unconditionally returns a reference now. But I also like to be able to do stuff like this: foreach my $prod (Product::Manager->get_products(...)) Hrm. Any more opinions or ideas? Is there a happy medium?
Just always return an arrayref, and if the user wants a list, they can typecast one?
for my $prod ( @{ Product::Manager->get_products(...) } ) Alternatively go the DBI:: route and have two methods? @x = get_products() $x = get_products_arrayref() or $x = getref_products() --Torsten ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object