Re: Moo, multiple-inheritance, unexpectedly uninitialized attributes
[email protected] (Jim Bacon) Thu, 26 Mar 2015 17:03:52 -0700
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <[email protected]> |
--Apple-Mail=_8B4AA3CB-440F-4D2E-B5F4-17E391F72773 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" I would think that you would want to get rid of the multiple inheritance = if possible by making one them a role unless refactoring to that extent = is not possible. Jim On Mar 26, 2015, at 3:35 PM, Kent Fredric <[email protected]> wrote: >=20 > On 27 March 2015 at 11:23, Diab Jerius <[email protected]> = wrote: >=20 > $ perl tst2 > b1 > Use of uninitialized value in say at tst2 line 30. >=20 > In tst2, if I explicitly initialize the attribute from the second = class: >=20 > my $q =3D C11->new( b2 =3D> 'BBB' ); >=20 > It is still output as uninitialized. >=20 > Would someone please point out what I'm missing? >=20 > Thanks, >=20 > Diab >=20 >=20 > Seems if you make your accessors lazy, then it works. >=20 > Which implies something is weird in construction. >=20 >=20 > --=20 > Kent=20 >=20 > KENTNL - https://metacpan.org/author/KENTNL --Apple-Mail=_8B4AA3CB-440F-4D2E-B5F4-17E391F72773 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="us-ascii" <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html = charset=3Dus-ascii"></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>I = would think that you would want to get rid of the multiple inheritance = if possible by making one them a role unless refactoring to that extent = is not possible.</div><div><br></div><div>Jim</div><br><div><div>On Mar = 26, 2015, at 3:35 PM, Kent Fredric <<a = href=3D"mailto:[email protected]">[email protected]</a>> = wrote:</div><br class=3D"Apple-interchange-newline"><blockquote = type=3D"cite"><div class=3D"gmail_extra" style=3D"font-family: = Helvetica; font-size: 12px; font-style: normal; font-variant: normal; = font-weight: normal; letter-spacing: normal; line-height: normal; = orphans: auto; text-align: start; text-indent: 0px; text-transform: = none; white-space: normal; widows: auto; word-spacing: 0px; = -webkit-text-stroke-width: 0px;"><div class=3D"gmail_quote"><br = class=3D"Apple-interchange-newline">On 27 March 2015 at 11:23, Diab = Jerius<span class=3D"Apple-converted-space"> </span><span = dir=3D"ltr"><<a href=3D"mailto:[email protected]" = target=3D"_blank">[email protected]</a>></span><span = class=3D"Apple-converted-space"> </span>wrote:<br><blockquote = class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; = border-left-width: 1px; border-left-color: rgb(204, 204, 204); = border-left-style: solid; padding-left: 1ex;"><br>$ perl = tst2<br>b1<br>Use of uninitialized value in say at tst2 line = 30.<br><br>In tst2, if I explicitly initialize the attribute from the = second class:<br><br> <span = class=3D"Apple-converted-space"> </span>my $q =3D C11->new( b2 = =3D> 'BBB' );<br><br>It is still output as = uninitialized.<br><br>Would someone please point out what I'm = missing?<br><br>Thanks,<br><br>Diab</blockquote></div><br><br></div><div = class=3D"gmail_extra" style=3D"font-family: Helvetica; font-size: 12px; = font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; line-height: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Seems = if you make your accessors lazy, then it works.<br><br></div><div = class=3D"gmail_extra" style=3D"font-family: Helvetica; font-size: 12px; = font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; line-height: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Which = implies something is weird in construction.<br></div><div = class=3D"gmail_extra" style=3D"font-family: Helvetica; font-size: 12px; = font-style: normal; font-variant: normal; font-weight: normal; = letter-spacing: normal; line-height: normal; orphans: auto; text-align: = start; text-indent: 0px; text-transform: none; white-space: normal; = widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><br = clear=3D"all"><br>--<span = class=3D"Apple-converted-space"> </span><br><div = class=3D"gmail_signature"><div dir=3D"ltr"><div>Kent<font = size=3D"1"><b><span = class=3D"Apple-converted-space"> </span><br><br></b></font></div><div= ><span style=3D"color: rgb(204, 204, 204);"><font = size=3D"1"><b>KENTNL</b><span = class=3D"Apple-converted-space"> </span>-<span = class=3D"Apple-converted-space"> </span><a = href=3D"https://metacpan.org/author/KENTNL" = target=3D"_blank">https://metacpan.org/author/KENTNL</a></font></span></di= v></div></div></div></blockquote></div><br></body></html>= --Apple-Mail=_8B4AA3CB-440F-4D2E-B5F4-17E391F72773--