Moo, multiple-inheritance, unexpectedly uninitialized attributes
[email protected] (Diab Jerius) Thu, 26 Mar 2015 18:23:42 -0400
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <CADpyd5Az3Ek3nXZGXfU-3TX0fWoF7tVuQ1_wbXJ1iwzEhyCxsA@mail.gmail.com> |
--001a11c3a9f04e94b00512387aa3 Content-Type: text/plain; charset=UTF-8 I've translated some code using multiple inheritance to Moo, and am seeing some unexpected behavior, namely that attributes inherited from the second parent class are not properly initialized. I've attached simplified versions of the pre- and post- Moo code. The pre-Moo code generates this: $ perl tst1 b1 b2 The Moo code outputs this: $ perl tst2 b1 Use of uninitialized value in say at tst2 line 30. In tst2, if I explicitly initialize the attribute from the second class: my $q = C11->new( b2 => 'BBB' ); It is still output as uninitialized. Would someone please point out what I'm missing? Thanks, Diab --001a11c3a9f04e94b00512387aa3 Content-Type: application/octet-stream; name=tst1 Content-Disposition: attachment; filename=tst1 Content-Transfer-Encoding: base64 X-Attachment-Id: f_i7qq4jjj0 dXNlIHN0cmljdDsKdXNlIHdhcm5pbmdzOwoKdXNlIDUuMTAuMDsKCnBhY2thZ2UgQjEgewogICAg c3ViIG5ldyB7IGJsZXNzIHt9LCBzaGlmdCB9CiAgICBzdWIgYjEgeyAnYjEnIH0KfQoKcGFja2Fn ZSBCMiB7CiAgICBzdWIgbmV3IHsgYmxlc3Mge30sIHNoaWZ0IH0KICAgIHN1YiBiMiB7ICdiMicg fQp9CgpwYWNrYWdlIEMxIHsKICAgIHVzZSBiYXNlICdCMScsICdCMic7CiAgICBzdWIgbmV3IHsg Ymxlc3Mge30sIHNoaWZ0IH0KfQoKbXkgJHEgPSBDMS0+bmV3OwoKc2F5ICRxLT5iMTsKc2F5ICRx LT5iMjsKCg== --001a11c3a9f04e94b00512387aa3 Content-Type: application/octet-stream; name=tst2 Content-Disposition: attachment; filename=tst2 Content-Transfer-Encoding: base64 X-Attachment-Id: f_i7qq4p8y1 dXNlIHN0cmljdDsKdXNlIHdhcm5pbmdzOwoKdXNlIDUuMTAuMDsKCnBhY2thZ2UgQjExIHsKICAg IHVzZSBNb287CiAgICBoYXMgYjEgPT4gKAogICAgICAgIGlzICAgICAgPT4gJ3J3JywKICAgICAg ICBkZWZhdWx0ID0+ICdiMScsCiAgICApOwp9CgpwYWNrYWdlIEIyMSB7CiAgICB1c2UgTW9vOwog ICAgaGFzIGIyID0+ICgKICAgICAgICBpcyAgICAgID0+ICdydycsCiAgICAgICAgZGVmYXVsdCA9 PiAnYjInLAogICAgKTsKfQoKcGFja2FnZSBDMTEgewogICAgdXNlIE1vbzsKICAgIGV4dGVuZHMg J0IxMScsICdCMjEnOwp9CgpteSAkcSA9IEMxMS0+bmV3OwoKc2F5ICRxLT5iMTsKc2F5ICRxLT5i MjsKCg== --001a11c3a9f04e94b00512387aa3--