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 20:57
Subject:
Re: 'around' method modifier does not seem to work
Message ID:
CAPJsHfBBD_vZBGa3u6Xi7FPR7Na-xEX6_KXpWRSX+jF1jraOYA@mail.gmail.com
On Thu, Aug 6, 2015 at 4:04 PM, Marcos Barbeitos <msbarbeitos@gmail.com>
wrote:
>     around 'sequence' => sub
>     {
>         my $orig = shift;
>         my $self = shift;
>         my $sequence = uc shift;
>
>         # Do lots of things with $sequence and then
>
>         return $self->$orig( $sequence );
>     }
>
>     With no success, as expected. However, if I do:
>
>     around 'sequence' => sub
>     {
>         my $orig = shift;
>         my $self = shift;
>
>         return $self->$orig( @_ );
>     }
>
>     The attribute is set and life goes on. Of course, that does not work
for me because I need to do a bunch of things to the argument passed to
this method.

The only difference I see between these two subs is the argument passed to
$orig.
So, have you tried printing it to check that it is what you expect it to be?

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