[Dbix-class] how to add a method that performs a database lookup?

Nigel Metheringham nigel.metheringham at dev.intechnology.co.uk
Tue Dec 16 13:56:06 GMT 2008


On 16 Dec 2008, at 13:43, Adam Witney wrote:

> But can HashRefInflator be used with a 'search' instead of  a 'find'  
> method? (I tried and it seemed to return different results). I need  
> to pull the data out by a non-primary and non-unique field.


Remember that a search returns a resultset, so:-

    my $rs = $schema->resultset('Whatever')->search({black => 'white'});
    $rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
    while (my $hash = $rs->next) {
       # smoke your hash
    }

--
[ Nigel Metheringham             Nigel.Metheringham at InTechnology.com ]
[ - Comments in this message are my own and not ITO opinion/policy - ]




More information about the DBIx-Class mailing list