[% USE pessoa_fisica = Class('reciclar::cdbi::pessoa_fisica'); FOREACH item = [ "id", "primeiro_nome", "sobrenome", "display_name", "cep", "nome_logradouro", "numero", "cidade", "estado", "ddd", "telefone" ]; IF $item.defined(); THEN; # # Here was my problem. # I couldn't see that I needed the same construct in # both sides of the assignment operation, because the # de-reference operation have different behaviors # when used inside a hash lookup and alone, in kind # of "scalar context". # params.$item = $item; END; END; IF params.keys(); THEN; list_pessoa_fisica = pessoa_fisica.search_where( params, { logic => "and" } ); ELSE; list_pessoa_fisica = pessoa_fisica.retrieve_all(); END; %]