http://www.perlmonks.org?node_id=500943


in reply to Params::Validate or Attribute::Params::Validate?

Attribute::Params::Validate uses Attribute::Handlers. While I haven't testing this out, I suspect it breaks in any module that defines its own attribute handlers instead of using Attribute::Handlers. For example, Class::Std (see Class::Std : How does MODIFY_HASH_ATTRIBUTES work? -- in addition to lack of thread safety, yet another reason to be careful using it).

Params::Validate works just fine. I also find it useful to be able to define some default specs in one place and use it many times. With the attribute version, you always have to put the spec in the attribute line.

-xdg

Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

  • Comment on Re: Params::Validate or Attribute::Params::Validate?