[Moose-commits] r7569 - Mouse/trunk/lib/Mouse/Meta
sartak at code2.0beta.co.uk
sartak at code2.0beta.co.uk
Thu Feb 5 21:19:40 GMT 2009
Author: sartak
Date: 2009-02-05 13:19:39 -0800 (Thu, 05 Feb 2009)
New Revision: 7569
Modified:
Mouse/trunk/lib/Mouse/Meta/Class.pm
Log:
Factor out some bits of get_method_list so I can write
get_all_method_names
Modified: Mouse/trunk/lib/Mouse/Meta/Class.pm
===================================================================
--- Mouse/trunk/lib/Mouse/Meta/Class.pm 2009-02-05 21:11:13 UTC (rev 7568)
+++ Mouse/trunk/lib/Mouse/Meta/Class.pm 2009-02-05 21:19:39 UTC (rev 7569)
@@ -69,9 +69,9 @@
}
# copied from Class::Inspector
-sub get_method_list {
+my $get_methods_for_class = sub {
my $self = shift;
- my $name = $self->name;
+ my $name = shift;
no strict 'refs';
# Get all the CODE symbol table entries
@@ -79,8 +79,13 @@
grep !/^(?:has|with|around|before|after|blessed|extends|confess|override|super)$/,
grep { defined &{"${name}::$_"} }
keys %{"${name}::"};
- push @functions, keys %{$self->{'methods'}->{$name}};
+ push @functions, keys %{$self->{'methods'}->{$name}} if $self;
wantarray ? @functions : \@functions;
+};
+
+sub get_method_list {
+ my $self = shift;
+ $get_methods_for_class->($self, $self->name);
}
sub add_attribute {
More information about the Moose-commits
mailing list