Skip Menu |

This queue is for tickets about the Class-MOP CPAN distribution.

Report information
The Basics
Id: 41255
Status: resolved
Priority: 0/
Queue: Class-MOP

People
Owner: Nobody in particular
Requestors: gfuji [...] cpan.org
Cc:
AdminCc:

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



Hello. When writing Class::MOP::Class->get_method_map() in XS, I found that it is inconsistent. Geven the following class: #!perl -w { package Base; sub m1{ 'foo' } sub m2{ 'bar' } } { package Derived; use parent -norequire => qw(Base); sub m1; # stub sub m2 :method; # stub with an attribute } eval{ Derived->m1() } or warn $@; eval{ Derived->m2() } or warn $@; __END__ The Perl method dispatch mechanism will find m1() and m2() in Derived and throw fatal errors like "Undefined subroutine &Derived::m1 called at...". Class::MOP::Class->get_method_map(), however, won't find m1() in Derived, while finding m2() in Derived. I think it should find m1() in Derived as Perl does. Regards, -- Goro Fuji (GFUJI at CPAN.org)
Oh, I have forget to attach a test script. -- Goro Fuji (GFUJI at CPAN.org)
#!perl -w use strict; use Test::More tests => 5; use Class::MOP; { package Base; sub m1{ 1 } sub m2{ 2 } sub m3{ 3 } sub m4{ 4 } sub m5{ 5 } package Derived; use parent -norequire => qw(Base); sub m1; sub m2 (); sub m3 :method; sub m4; m4() if 0; sub m5; our $m5; } my $meta = Class::MOP::Class->initialize('Derived'); foreach my $method('m1' .. 'm5'){ is $meta->find_method_by_name($method)->fully_qualified_name, "Derived::$method"; }
Oh, I have forget to attach a test script. -- Goro Fuji (GFUJI at CPAN.org)
#!perl -w use strict; use Test::More tests => 5; use Class::MOP; { package Base; sub m1{ 1 } sub m2{ 2 } sub m3{ 3 } sub m4{ 4 } sub m5{ 5 } package Derived; use parent -norequire => qw(Base); sub m1; sub m2 (); sub m3 :method; sub m4; m4() if 0; sub m5; our $m5; } my $meta = Class::MOP::Class->initialize('Derived'); foreach my $method('m1' .. 'm5'){ is $meta->find_method_by_name($method)->fully_qualified_name, "Derived::$method"; }