develooper Front page | perl.moose | Postings from August 2015

Re: 'around' method modifier does not seem to work

Thread Previous | Thread Next
From:
Karen Etheridge
Date:
August 9, 2015 21:01
Subject:
Re: 'around' method modifier does not seem to work
Message ID:
CAPJsHfAMbxprD5-7bxefLFSUiB=t9g3cT=i5OjhxzVdF42ZvYg@mail.gmail.com
> On Sat, Aug 8, 2015 at 1:18 PM, Marcos Barbeitos <msbarbeitos@gmail.com>
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.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About