I would take a look at Params::Validate, Params::Smart (shameless plug ;) or one of the many other Params::* modules to do the work of setting default values as well as validating then.
In reply to Use Params::Validate or a similar module
by rrwo
in thread Best method of assigning "default" values?
by jqcoffey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |