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