|Just another Perl shrine|
Re: DBI isn't using default row valuesby CountZero (Bishop)
|on Nov 29, 2016 at 07:22 UTC ( #1176771=note: print w/replies, xml )||Need Help??|
More generally, I find default values to be hazardous.
You can have defaults at the level of your database, or at the level of a framework like DBIx::Class or Moose, or in your application code.
Invariably, after a while somehow working with your database and code will fail to read the docs or simply forgets about all these different defaults and introduces hard to trace errors. Or as in the case of the OP, just doesn't know how to trigger the defaults.
I think it is much better if the database complains loudly when a required field remains empty. Then it is immediately obvious where the error is.
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey JamesMy blog: Imperial Deltronics
In Section Seekers of Perl Wisdom