Re: 'around' method modifier does not seem to work
[email protected] (Karen Etheridge) Sat, 8 Aug 2015 16:52:24 -0700
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <CAPJsHfAMbxprD5-7bxefLFSUiB=t9g3cT=i5OjhxzVdF42ZvYg@mail.gmail.com> |
--047d7b339fafaa0687051cd5715a Content-Type: text/plain; charset=UTF-8 > On Sat, Aug 8, 2015 at 1:18 PM, Marcos Barbeitos <[email protected]> wrote: > I get it to work. Not a very elegant solution, for I must access the attribute directly instead of using an accessor. No, instead of > return $self->{sequence}; you should do return $self->$orig(); to use the proper reader mechanism. > One issue still remains though, if I pass the argument to the constructor: > my $collection = DCSE::Collection->new > ( > id => 'test' > , sequence => $sequence > , helix => $dcse->helix > ); > > I believe that 'around' is not called, for I get the unparsed argument when I fetch the attribute. This should be fixed when you fix the code path for the reader as above. --047d7b339fafaa0687051cd5715a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">> On Sat, Aug 8, 2015 at 1:18 PM, Marcos Barbeitos <= <a href=3D"mailto:[email protected]">[email protected]</a>> wrot= e:<br><br>>=C2=A0=C2=A0=C2=A0=C2=A0 I get it to work.=C2=A0 Not a very e= legant solution, for I must access the attribute directly instead of using = an accessor. <br><br>No, instead of<br>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return $self->{sequence};=C2= =A0=C2=A0=C2=A0 =C2=A0<br>you should do<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 return $self->$orig();<= br>to use the proper reader mechanism.<br><br>>=C2=A0=C2=A0=C2=A0=C2=A0 = One issue still remains though, if I pass the argument to the constructor:<= br>>=C2=A0=C2=A0=C2=A0=C2=A0 my $collection =3D DCSE::Collection->new= <br>>=C2=A0=C2=A0=C2=A0=C2=A0 (<br>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 id =3D> 'test'<br>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,= sequence =3D> $sequence<br>>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 , helix = =3D> $dcse->helix<br>>=C2=A0=C2=A0=C2=A0=C2=A0 );<br>> <br>>= =C2=A0=C2=A0=C2=A0=C2=A0 I believe that 'around' is not called, for= I get the unparsed argument when I fetch the attribute. <br><br>This shoul= d be fixed when you fix the code path for the reader as above.<br><br></div= > --047d7b339fafaa0687051cd5715a--