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">&gt; On Sat, Aug 8, 2015 at 1:18 PM, Marcos Barbeitos &lt;=
<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrot=
e:<br><br>&gt;=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>&gt;=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-&gt;{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-&gt;$orig();<=
br>to use the proper reader mechanism.<br><br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0 =
One issue still remains though, if I pass the argument to the constructor:<=
br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0 my $collection =3D DCSE::Collection-&gt;new=
<br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0 (<br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 id =3D&gt; &#39;test&#39;<br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 ,=
 sequence =3D&gt; $sequence<br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 , helix =
=3D&gt; $dcse-&gt;helix<br>&gt;=C2=A0=C2=A0=C2=A0=C2=A0 );<br>&gt; <br>&gt;=
=C2=A0=C2=A0=C2=A0=C2=A0 I believe that &#39;around&#39; 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--