X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FModule.pm;h=ec9932ffb8f251538516bb08c76c36812d6e497e;hp=db89b975339362dadc29e015ef51515ecccfd677;hb=013ee5f0c0ce5afa1fea9d45bd14bd8f8bfd67f4;hpb=4c0fe06fa87e7c2c4ed1666e77ed52ae020f19d7 diff --git a/lib/Mouse/Meta/Module.pm b/lib/Mouse/Meta/Module.pm index db89b97..ec9932f 100755 --- a/lib/Mouse/Meta/Module.pm +++ b/lib/Mouse/Meta/Module.pm @@ -6,8 +6,7 @@ use Scalar::Util (); my %METAS; -# XXX: work around a warning "useless use of a constant in void context" in 5.6.2 -if(&Mouse::Util::MOUSE_XS){ +if(Mouse::Util::MOUSE_XS){ # register meta storage for performance Mouse::Util::__register_metaclass_storage(\%METAS, 0); @@ -17,6 +16,7 @@ if(&Mouse::Util::MOUSE_XS){ sub _metaclass_cache { # DEPRECATED my($class, $name) = @_; + Carp::cluck('_metaclass_cache() has been deprecated. Use Mouse::Util::get_metaclass_by_name() instead'); return $METAS{$name}; } @@ -79,7 +79,7 @@ sub namespace; # add_attribute is an abstract method sub get_attribute_map { # DEPRECATED - Carp::cluck('get_attribute_map() has been deprecated'); + Carp::cluck('get_attribute_map() has been deprecated. Use get_attribute_list() and get_attribute() instead'); return $_[0]->{attributes}; } @@ -150,6 +150,37 @@ sub get_method_list { return grep { $self->has_method($_) } keys %{ $self->namespace }; } +sub _collect_methods { # Mouse specific + my($meta, @args) = @_; + + my @methods; + foreach my $arg(@args){ + if(my $type = ref $arg){ + if($type eq 'Regexp'){ + push @methods, grep { $_ =~ $arg } $meta->get_all_method_names; + } + elsif($type eq 'ARRAY'){ + push @methods, @{$arg}; + } + else{ + my $subname = ( caller(1) )[3]; + $meta->throw_error( + sprintf( + 'Methods passed to %s must be provided as a list, ArrayRef or regular expression, not %s', + $subname, + $type, + ) + ); + } + } + else{ + push @methods, $arg; + } + } + return @methods; +} + + { my $ANON_SERIAL = 0; @@ -311,7 +342,7 @@ Mouse::Meta::Module - The base class for Mouse::Meta::Class and Mouse::Meta::Rol =head1 VERSION -This document describes Mouse version 0.41 +This document describes Mouse version 0.50 =head1 SEE ALSO