Skip Menu |

This queue is for tickets about the Object-Pad CPAN distribution.

Report information
The Basics
Id: 133657
Status: new
Priority: 0/
Queue: Object-Pad

People
Owner: Nobody in particular
Requestors: leonerd-cpan [...] leonerd.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 0.33
Fixed in: (no value)



Subject: __SUB__ inside a role method gives the wrong answer
On a plain class: $ perl -e ' use feature "current_sub"; package C { sub m { printf "%#x\n", __SUB__ } } printf "%#x\n", C->can("m"); C->m' 0x5600fd1d8100 0x5600fd1d8100 -- identical On an Object::Pad class: $ perl -MObject::Pad -e ' use feature "current_sub"; class C { method m { printf "%#x\n", __SUB__ } } printf "%#x\n", C->can("m"); C->new->m' 0x5576460c5338 0x5576460c5338 -- identical On an Object::Pad class via a role: $ perl -MObject::Pad -e ' use feature "current_sub"; role R { method m { printf "%#x\n", __SUB__ } } class C implements R {} printf "%#x\n", C->can("m"); C->new->m' 0x5605567546f8 0x560556778330 -- Expected same address Turns out that __SUB__ actually sees the address of the original method in the role: $ perl -MObject::Pad -e ' use feature "current_sub"; role R { method m { printf "%#x\n", __SUB__ } } class C implements R {} printf "%#x\n", R->can("m"); C->new->m' 0x5614499be120 0x5614499be120 -- Paul Evans