has => sub {
my $class = $CALLER;
return subname 'Moose::has' => sub ($;%) {
- my ($name, %options) = @_;
- $class->meta->_process_attribute($name, %options);
+ my ($name, %options) = @_;
+ my $attrs = (ref($name) eq 'ARRAY') ? $name : [($name)];
+ $class->meta->_process_attribute($_, %options) for @$attrs;
};
},
before => sub {
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More tests => 8;
use Test::Exception;
BEGIN {
$test->good_lazy_attr;
} '... this does not work';
}
+
+{
+ {
+ package Test::Arrayref::Attributes;
+ use Moose;
+
+ has [qw(foo bar baz)] => (
+ is => 'rw',
+ );
+
+ }
+
+ my $test = Test::Arrayref::Attributes->new;
+ isa_ok($test, 'Test::Arrayref::Attributes');
+ can_ok($test, qw(foo bar baz));
+
+}