Export to GitHub

perl-compiler - issue #301

mro next method not available


Posted on Feb 13, 2014 by Massive Bear

What steps will reproduce the problem?

> perlcc -r -e "{ package A; use mro 'c3'; sub foo { 'A::foo' } } { package B; use base 'A'; use mro 'c3'; sub foo { (shift)->next::method() } } print qq{ok\n} if B->foo eq 'A::foo';" Can't locate object method "method" via package "next" (perhaps you forgot to load "next"?) at -e line 1.

What is the expected output?

> perl -e "{ package A; use mro 'c3'; sub foo { 'A::foo' } } { package B; use base 'A'; use mro 'c3'; sub foo { (shift)->next::method() } } print qq{okif B->foo eq 'A::foo';" ok

Please use labels and text to provide additional information.

Comment #1

Posted on Feb 13, 2014 by Massive Bear

mro is not compiled in the binary

Comment #2

Posted on Feb 13, 2014 by Massive Bear

adding a 'require mro' in the main level solves that issue

Comment #3

Posted on Feb 14, 2014 by Grumpy Rhino

In this case the same root cause as #300

Comment #4

Posted on May 8, 2014 by Massive Bear

still an issue even after fix for 300

Comment #5

Posted on May 9, 2014 by Grumpy Rhino

(No comment was entered for this change.)

Comment #6

Posted on May 9, 2014 by Grumpy Rhino

Issue 324 has been merged into this issue.

Comment #7

Posted on May 9, 2014 by Grumpy Rhino

re-opened with updated t/testc.sh commit a0056c45c9d773762c6c19b257bf836265294a06 Author: Reini Urban Date: Thu May 8 19:10:27 2014 -0500

t/testc.sh: add 301 and 324

Comment #8

Posted on May 9, 2014 by Grumpy Rhino

failure is caused by next::can and next::method from mro not being compiled in. Need to special-case it for method_named.

-Dp =>

Considering maybe::next Delete maybe::next Considering next Delete next Considering next Cached next is already deleted

Comment #9

Posted on May 9, 2014 by Grumpy Rhino

Fixed with commit 0c51242a8f2ae9743f873c2d13aca3042a6813eb Author: Reini Urban Date: Thu May 8 23:47:16 2014 -0500

C: detect ->next::method (and more)

check for special next|maybe|NEXT::EVERY methods and include the package
if used. Fixes issues 301 and 324.
threaded const->PVs are especially hard to access

Status: Fixed

Labels:
Type-Defect Priority-Medium