Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mro next::method doesn't work from imported method #14769

Open
p5pRT opened this issue Jun 23, 2015 · 7 comments
Open

mro next::method doesn't work from imported method #14769

p5pRT opened this issue Jun 23, 2015 · 7 comments

Comments

@p5pRT
Copy link

p5pRT commented Jun 23, 2015

Migrated from rt.perl.org#125461 (status was 'open')

Searchable as RT125461$

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2015

From @dolmen

Hi,

I would like to use next​::method from a method implemented in a role and injected in a class by aliasing methods.
But it seems next​::method doesn't work in that case​: it doesn't find the super method.

See the attached code for a self contained minimal test case.

Here is the (failing) output​:

------8<------8<------8<------8<------8<------8<------8<------
$ perl next_method.pl
1..1
# perl v5.22.0
Hi2 from Child!
Hi2 from Parent!
Hi2 from Child!
Hi2 from Parent!
Hi from Role!
not ok 1
# Failed test at next_method.pl line 69.
# got​: 'No next​::method 'hello' found for Child at /home/omengue/.plenv/versions/5.22.0/lib/perl5/5.22.0/x86_64-linux/mro.pm line 27.
# '
# expected​: undef
# Looks like you failed 1 test of 1.
------8<------8<------8<------8<------8<------8<------8<------

--
Olivier Mengué <dolmen@​cpan.org>

@p5pRT
Copy link
Author

p5pRT commented Jun 23, 2015

From @dolmen

next_method.pl

@p5pRT
Copy link
Author

p5pRT commented Aug 3, 2015

From @dolmen

This ticket didn't get much attention.

Le Mar 23 Juin 2015 05​:29​:11, dolmen a écrit :

Hi,

I would like to use next​::method from a method implemented in a role
and injected in a class by aliasing methods.
But it seems next​::method doesn't work in that case​: it doesn't find
the super method.

See the attached code for a self contained minimal test case.

Here is the (failing) output​:

------8<------8<------8<------8<------8<------8<------8<------
$ perl next_method.pl
1..1
# perl v5.22.0
Hi2 from Child!
Hi2 from Parent!
Hi2 from Child!
Hi2 from Parent!
Hi from Role!
not ok 1
# Failed test at next_method.pl line 69.
# got​: 'No next​::method 'hello' found for Child at
/home/omengue/.plenv/versions/5.22.0/lib/perl5/5.22.0/x86_64-
linux/mro.pm line 27.
# '
# expected​: undef
# Looks like you failed 1 test of 1.
------8<------8<------8<------8<------8<------8<------8<------

--
Olivier Mengué <dolmen@​cpan.org>

@p5pRT
Copy link
Author

p5pRT commented Aug 3, 2015

From [Unknown Contact. See original ticket]

This ticket didn't get much attention.

Le Mar 23 Juin 2015 05​:29​:11, dolmen a écrit :

Hi,

I would like to use next​::method from a method implemented in a role
and injected in a class by aliasing methods.
But it seems next​::method doesn't work in that case​: it doesn't find
the super method.

See the attached code for a self contained minimal test case.

Here is the (failing) output​:

------8<------8<------8<------8<------8<------8<------8<------
$ perl next_method.pl
1..1
# perl v5.22.0
Hi2 from Child!
Hi2 from Parent!
Hi2 from Child!
Hi2 from Parent!
Hi from Role!
not ok 1
# Failed test at next_method.pl line 69.
# got​: 'No next​::method 'hello' found for Child at
/home/omengue/.plenv/versions/5.22.0/lib/perl5/5.22.0/x86_64-
linux/mro.pm line 27.
# '
# expected​: undef
# Looks like you failed 1 test of 1.
------8<------8<------8<------8<------8<------8<------8<------

--
Olivier Mengué <dolmen@​cpan.org>

@p5pRT
Copy link
Author

p5pRT commented Aug 3, 2015

From @dur-randir

Hello,

In your script you see details of the current next​::method()
implementation. To get an inheritance chain start, it looks not into
the function location (stash + glob pair), but into it's 'name' -
thing that you can, for example, set with Sub​::Name​::subname().

See this https://gist.github.com/dur-randir/b80000cea918434999be for
some (weird) tricks you can do with it.

Best regards,
Sergey Aleynikov

@p5pRT
Copy link
Author

p5pRT commented Apr 1, 2017

From zefram@fysh.org

This behaviour of next​::method is called out in a "Caveat" segment of the
"mro" documentation. There is no bug here, and not even a documentation
deficiency.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Apr 1, 2017

The RT System itself - Status changed from 'new' to 'open'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants