my %exports = (
extends => sub {
my $class = $CALLER;
- return subname 'Moose::extends' => sub ($;@) {
+ return subname 'Moose::extends' => sub (@) {
+ confess "Must derive at least one class" unless @_;
_load_all_classes(@_);
my $meta = $class->meta;
foreach my $super (@_) {
},
with => sub {
my $class = $CALLER;
- return subname 'Moose::with' => sub ($;@) {
+ return subname 'Moose::with' => sub (@) {
my (@roles) = @_;
+ confess "Must specify at least one role" unless @roles;
_load_all_classes(@roles);
($_->can('meta') && $_->meta->isa('Moose::Meta::Role'))
|| confess "You can only consume roles, $_ is not a Moose role"
},
with => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::with' => sub ($;@) {
+ return subname 'Moose::Role::with' => sub (@) {
my (@roles) = @_;
+ confess "Must specify at least one role" unless @roles;
Moose::_load_all_classes(@roles);
($_->can('meta') && $_->meta->isa('Moose::Meta::Role'))
|| confess "You can only consume roles, $_ is not a Moose role"
},
requires => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::requires' => sub ($;@) {
+ return subname 'Moose::Role::requires' => sub (@) {
+ confess "Must specify at least one method" unless @_;
$meta->add_required_methods(@_);
};
},
excludes => sub {
my $meta = _find_meta();
- return subname 'Moose::Role::excludes' => sub ($;@) {
+ return subname 'Moose::Role::excludes' => sub (@) {
+ confess "Must specify at least one role" unless @_;
$meta->add_excluded_roles(@_);
};
},
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
-=cut
\ No newline at end of file
+=cut