[Dbix-class] Searching - two criteria for the same field
Peter Rabbitson
rabbit+dbic at rabbit.us
Tue Feb 10 08:33:46 GMT 2009
Gerg Coates wrote:
> I need to do a search on a resultset that is filtered by two values on
> the same field.
>
> I tried code like this, but it doesn't seem to be working:
>
> my $t = $schema->resultset('Table')->search(
> {
> 'glr_date' => { '>=', $beg_date },
> 'glr_date' => { '<', $end_date }
> }
> );
Although your question got answered, it wasnt' pointed out _why_ it
doesn't work. This is basic perl, you can not specify the same key
twice in a hash:
rabbit at Thesaurus:~$ perl -MData::Dumper \
> -e 'my %hash = ( key_1 => "value1", key_2 => "value2", key_1 => "second value 1"); print Dumper \%hash'
$VAR1 = {
'key_1' => 'second value 1',
'key_2' => 'value2'
};
rabbit at Thesaurus:~$
More information about the DBIx-Class
mailing list