Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 11689
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Class-Meta

People
Owner: Nobody in particular
Requestors: canfieldtim [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.10
Fixed in: 0.46



Date: Mon, 28 Feb 2005 13:05:33 -0500
From: Tim Canfield <canfieldtim [...] gmail.com>
To: bug-class-meta [...] rt.cpan.org
Subject: add_method in Meta.pm
Hi, This isn't necessarily a bug, but I wasn't sure the appropriate place to send this. Would you be willing to change add_method() from: sub add_method { my $class = $classes{ shift->{package} }; $class->{method_class}->new($class, @_); } To: sub add_method { my $class = $classes{ shift->{package} }; push @{$class->{build_meth_ord}}, $class->{method_class}->new($class, @_); return $class->{build_meth_ord}[-1]; } This follows the model of the other add_* methods. I would like this functionality because I have extended Class::Meta::Method to actually create the method and incorporate parameter checking. My perl expertise is limited, but my understanding is that the $classes hash is not available to children of Class::Meta and as a result I can not simply override add_method and rely on Class::Meta::build to call build within my Method class. If this is not correct, I would be grateful if you could correct my understanding. Thanks, Tim
From: David Wheeler <david [...] kineticode.com>
Subject: Re: [cpan #11689] add_method in Meta.pm
Date: Tue, 8 Mar 2005 11:25:05 -0800
To: bug-Class-Meta [...] rt.cpan.org
RT-Send-Cc:
On Feb 28, 2005, at 10:15 AM, Tim Canfield via RT wrote: Show quoted text
> Hi, > > This isn't necessarily a bug, but I wasn't sure the appropriate place > to send this. > > Would you be willing to change add_method() from: > > sub add_method { > my $class = $classes{ shift->{package} }; > $class->{method_class}->new($class, @_); > } > > To: > > sub add_method { > my $class = $classes{ shift->{package} }; > push @{$class->{build_meth_ord}}, > $class->{method_class}->new($class, @_); > return $class->{build_meth_ord}[-1]; > }
Done. It will be in 0.46 to be released shortly. Show quoted text
> This follows the model of the other add_* methods. I would like this > functionality because I have extended Class::Meta::Method to actually > create the method and incorporate parameter checking.
Cool! Show quoted text
> My perl > expertise is limited, but my understanding is that the $classes hash > is not available to children of Class::Meta and as a result I can not > simply override add_method and rely on Class::Meta::build to call > build within my Method class. If this is not correct, I would be > grateful if you could correct my understanding.
That is correct, good analysis. With your change, however, it should get you want you want, yes? Regards, David