2

So it appears that in order to pass something in weaver.ini the plugin itself requires a Moose attribute. So if I have something like this in weaver.ini

[Acknowledgements]
contributors = 'test foo' 'foo bar'

I need a corresponding attribute in my plugin.

has contributors => (
    is      => 'rw',
    isa     => 'ArrayRef[Str]',
    traits  => [ 'Array' ],
    default => sub { [ ] },
    handles => {
        contributors_count => 'count',
    },
);

However, I'm getting the error

Attribute (contributors) does not pass the type constraint because: Validation failed for 'ArrayRef[Str]' with value 'test foo' 'foo bar' at /home/xenoterracide/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/x86_64-linux-thread-multi/Moose/Meta/Attribute.pm line 1248

I'm not sure where I'm going wrong. I've tried changing the syntax up in weaver.ini but that doesn't seem to be it.

Jonas
  • 121,568
  • 97
  • 310
  • 388
xenoterracide
  • 16,274
  • 24
  • 118
  • 243

1 Answers1

3

The .ini syntax for that is slightly different.

[Acknowledgements]
contributor = test foo
contributor = foo bar

In addition to that, you'll have to tell Config::MVP, which is what takes care of Dist::Zilla's config loading, that your plugin's contributor option may have multiple values:

sub mvp_multivalue_args { qw(contributors) }
rafl
  • 11,980
  • 2
  • 55
  • 77
  • it would appear though that something else has to change before I could call it contributors in code and contributor in config. As simply doing this results in `multiple values given for property contributor in section Acknowledgements at /home/xenoterracide/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Config/MVP/Assembler.pm line 98` – xenoterracide Aug 07 '11 at 23:19