Hi Shawn!

On Wed, 29 Mar 2017 08:09:12 -0400
Shawn H Corey <shawnhco...@gmail.com> wrote:

> On Wed, 29 Mar 2017 09:25:06 +0800
> PYH <p...@vodafonemail.de> wrote:
> 
> > sub my_recursion {
> >      my $self = shift;
> >      ....
> >      if (...) {
> >          $self->my_recursion;  
> 
> # you don't need $self. subroutine lookup starts
> # in the same package. Just the sub by itself
> # is good enough.
>     my_recursion();
> 

my_recursion accepts $self as its first argument, so you should pass it there.
Doing «my_recursion($self);» is one option for doing that but : 1. It looks
ugly. 2. It's less future proof. 3. It's a bad practice for OOP perl.

The original code was fine.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to