2

そのため、プラグイン自体に何かを渡すにweaver.iniは Moose 属性が必要なようです。だから私はこのようなものを持っている場合weaver.ini

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

プラグインに対応する属性が必要です。

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

ただし、エラーが発生します

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

どこが間違っているのかわかりません。構文を上に変更しようとしましたweaver.iniが、そうではないようです。

4

1 に答える 1

3

その.ini構文は少し異なります。

[Acknowledgements]
contributor = test foo
contributor = foo bar

それに加えて、プラグインのオプションが複数の値を持つ可能性があることを、 の構成の読み込みをConfig::MVP処理する に伝える必要があります。Dist::Zillacontributor

sub mvp_multivalue_args { qw(contributors) }
于 2011-08-06T18:05:19.003 に答える