Overriding retrieve all for specific ordering
By default, $class->retrieve_all will return a set of objects based on the order in the database. You can override it in your class file so that it is ordered by a specific column.
package Hosts; __PACKAGE__->table("hosts"); __PACKAGE__->columns(All => qw/id name/); __PACKAGE__->set_sql(RetrieveAll => <<); SELECT __ESSENTIAL__ FROM __TABLE__ ORDER BY name
Now when a Hosts->retrieve_all is called, it will return a list of hosts, ordered by name.
You could also use Class::DBI::Plugin::RetrieveAll, which provides several methods for doing this.