in reply to Issues with DBIx::Class

DBIx::Class has a mis-feature where the ->search method is context-aware. In list context, it runs the query and you get back the rows. In scalar context it returns a resultset which you can continue chaining methods on and decide to run the query later. One workaround is the ->search_rs method which always returns a resultset.

The ->all method always returns a list (not arrayref) of rows. You got "123" because you tried assigning a list to a scalar, which gives you the size of the list.

The rows are objects by default. If you want hashrefs, use DBIx::Class::ResultClass::HashRefInflator. You can also use $row->get_columns to dump the key/value pairs from a row object but if you don't want the object in the first place, just use HashRefInflator and get better performance.

If you are doing a lot of work with DBIx::Class, consider using DBIx::Class::Helper::ResultSet which smooths over some of the rough edges of the DBIx::Class API. With this module installed, you can write:

for my $hashref ($c->model('DB::Thing')->hri->all) { ... }