X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=xs-src%2FMouseAttribute.xs;h=7a453fd2f7d0ac1ccb68a7ccebdebd218569f2b1;hb=fd2b172a4657cb6cc47976d2e66cdba4bdfa579d;hp=617a99a6cbd17e9119c48d5a9778a96c5aba50bb;hpb=d06d926635763fa5687c429b5ad39938c564fbed;p=gitmo%2FMouse.git diff --git a/xs-src/MouseAttribute.xs b/xs-src/MouseAttribute.xs index 617a99a..7a453fd 100644 --- a/xs-src/MouseAttribute.xs +++ b/xs-src/MouseAttribute.xs @@ -15,7 +15,7 @@ mouse_build_xa(pTHX_ SV* const attr) { ENTER; SAVETMPS; - xa = newAV(); + xa = newAV(); mg = sv_magicext(SvRV(attr), (SV*)xa, PERL_MAGIC_ext, &mouse_xa_vtbl, NULL, 0); SvREFCNT_dec(xa); /* refcnt++ in sv_magicext */ @@ -184,6 +184,7 @@ mouse_xa_set_default(pTHX_ AV* const xa, SV* const object) { return value; } +/* checks $isa->does($does) */ static void mouse_check_isa_does_does(pTHX_ SV* const klass, SV* const name, SV* const isa, SV* const does){ STRLEN len; @@ -249,6 +250,7 @@ BOOT: INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_auto_deref, auto_deref); INSTALL_SIMPLE_READER_WITH_KEY(Attribute, should_coerce, coerce); INSTALL_SIMPLE_READER(Attribute, documentation); + INSTALL_SIMPLE_READER(Attribute, insertion_order); /* predicates */ INSTALL_SIMPLE_PREDICATE_WITH_KEY(Attribute, has_accessor, accessor); @@ -270,6 +272,7 @@ void _process_options(SV* klass, SV* name, HV* args) CODE: { + /* TODO: initialize 'xa' here */ SV** svp; SV* tc = NULL; @@ -318,7 +321,7 @@ CODE: "without a default, builder, or an init_arg", name); } - /* taken from Mouse::Meta::Attribute->new and ->_process_args */ + /* taken from Mouse::Meta::Attribute->new and ->_process_args */ svp = hv_fetchs(args, "is", FALSE); if(svp){ @@ -336,10 +339,12 @@ CODE: else{ svp = hv_fetchs(args, "accessor", TRUE); } - sv_setsv(*svp, name); + if(!SvOK(*svp)) { + sv_setsv(*svp, name); + } } else if(strEQ(is, "bare")){ - /* do nothing, but don't complain (later) about missing methods */ + /* do nothing, but might complain later about missing methods */ } else{ mouse_throw_error(klass, NULL, @@ -471,7 +476,7 @@ CODE: if(svp && sv_true(*svp)){ if(!(has_default || has_builder)){ mouse_throw_error(klass, NULL, - "You cannot have lazy attribute (%"SVf") without specifying " + "You cannot have a lazy attribute (%"SVf") without specifying " "a default value for it", name); } }