[html-formfu] Variation of H::FF::Constraint::DBIC::Unique [RFC]

Charlie Garrison garrison at zeta.org.au
Sat May 22 00:34:04 GMT 2010


Good morning,

I need a constraint which is identical to 
Constraint::DBIC::Unique in concept, but requires slightly 
different implementation. I can either create my own or supply 
patches for Constraint::DBIC::Unique. So I'm asking for comments 
from others.

Currently C::DBIC::Unique will only check for unique values by 
doing a 'find' (& checking primary keys) before returning true/false.

Rather than doing a find on a column in the resultset, I need to 
call a method on the resultset and return that value. The 
resultset method is simply checking for uniqueness across two 
tables, so maybe there is a better way of achieving that anyway.

Thoughts? Comments? Should I write a custom constraint or does 
this sound like a good addition to C::DBIC::Unique? My idea was 
to create an alternate config option; rather than supplying 
'column' in the Constraint config, supply 'method' instead. And 
C::DBIC::Unique would simply return the value from 'method' 
rather than doing a column find.

Another thought I had was a custom resultset class (view?) which 
combines both tables and just using C::DBIC::Unique as it is 
now. But that seems like more effort and not as clean.


Charlie

-- 
    Ꮚ Charlie Garrison ♊ <garrison at zeta.org.au>

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
〠  http://www.ietf.org/rfc/rfc1855.txt



More information about the HTML-FormFu mailing list