Re: 'around' method modifier does not seem to work
[email protected] (Kent Fredric) Sat, 8 Aug 2015 14:31:02 +1200
| Newsgroups | perl.moose |
|---|---|
| Message-ID | <CAATnKFAv5Gw9sUU3wsDyLSXmphFAEZMF_inKi60yqwhror7jZQ@mail.gmail.com> |
On 8 August 2015 at 09:09, Chris Prather <[email protected]> wrote: > If you check the part he quoted in the original email, that is in there. > Obviously three of us missed it so maybe it could be highlighted better. I think there's confusion stemming from there being *two* methods being wrapped, one has the guard, and the other has its internals elided, and we assume there is a guard. Method one is called "size": around 'size' => sub { my $orig = shift; my $self = shift; return $self->$orig() ##### Guard unless @_; my $size = shift; $size = $size / 2 if $self->likes_small_things(); return $self->$orig($size); }; Method two is called "sequence": around 'sequence' => sub { my $orig = shift; my $self = shift; my $sequence = uc shift; # Do lots of things with $sequence and then #### NO CLEAR GUARD return $self->$orig( $sequence ); } And as he describes, the issue he experiences is predominantly with the second of these, which makes sense, given there is no code that *we* can see with the guard mechanism. -- Kent KENTNL - https://metacpan.org/author/KENTNL