[Dbix-class] Deferred validation via accessors

Rob Kinyon rob.kinyon at gmail.com
Fri Jul 30 20:48:05 GMT 2010


On Fri, Jul 30, 2010 at 16:31, Paul Makepeace <paulm at paulm.com> wrote:
> I'm hoping to use custom accessors to do some validation of incoming
> data with reference to existing column data.

[snip lots of explanation that isn't helping much]

Why on earth are you setting stuff manually? It's obvious that you
have business-level actions you want to take. So, code _THOSE_ up and
have those do the right settings for foo_enabled, bar_enabled, and
default_view. If someone wants to set things to "illegal" values, they
should be able to. But, you'll be able to find those very easily with
grep because they're the only ones actually using foo_enabled,
bar_enabled, and/or default_view. All code outside the ResultSource
should use set_view_to() or whatever.

Remember - all problems are solvable by adding an additional layer of
abstraction (except, of course, the problem of too many layers of
abstraction).

-- 
Thanks,
Rob Kinyon



More information about the DBIx-Class mailing list