http://www.perlmonks.org?node_id=1054648


in reply to Re: method aliases with goto(&NAME)
in thread method aliases with goto(&NAME)

> If you swap in your goto implementation of the legacy method, then calling Child->legacy_method returns 1.

Don't you think this could perfectly be the intended behavior, since Child doesn't seem to have any legacy_method?

But your right that the OP was wrong about the equivalence.

Cheers Rolf

( addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^3: method aliases with goto(&NAME)
by tobyink (Canon) on Sep 18, 2013 at 13:26 UTC

    There are probably instances where you'd want two methods that behave identically in the parent class, but behave differently in the child class. However, given that the title of this thread mentioned "method aliases", I'm assuming the intention is that legacy_method acts as an alias (i.e. behaves identically) for current_method, unless a child class explicitly overrides legacy_method to make it behave differently.

    use Moops; class Cow :rw { has name => (default => 'Ermintrude') }; say Cow->new->name
      I had the impression that legacy_method is supposed to be deprecated and that overloading in new children is maybe not intended.

      Well I don't like speculating about the OPs intention, let's wait what he says... :)

      Cheers Rolf

      ( addicted to the Perl Programming Language)

Re^3: method aliases with goto(&NAME)
by ikegami (Patriarch) on Sep 18, 2013 at 19:27 UTC

    Don't you think this could perfectly be the intended behavior, since Child doesn't seem to have any legacy_method?

    Not for one second. The child provides a correct interface. The legacy caller uses a correct interface. It should work.