/* taken from Class::MOP::Attribute::new */
- if(!SvOK(name)){
- mouse_throw_error(klass, NULL,
- "You must provide a name for the attribute");
- }
+ must_defined(name, "an attribute name");
svp = hv_fetchs(args, "init_arg", FALSE);
if(!svp){
svp = hv_fetchs(args, "builder", FALSE);
if(svp){
if(!SvOK(*svp)){
- mouse_throw_error(klass, NULL,
+ mouse_throw_error(klass, *svp,
"builder must be a defined scalar value which is a method name");
}
can_be_required = TRUE;
}
else if((svp = hv_fetchs(args, "default", FALSE))){
if(SvROK(*svp) && SvTYPE(SvRV(*svp)) != SVt_PVCV) {
- mouse_throw_error(klass, NULL,
+ mouse_throw_error(klass, *svp,
"References are not allowed as default values, you must "
"wrap the default of '%"SVf"' in a CODE reference "
"(ex: sub { [] } and not [])", name);