# NAME

Dist::Zilla::Stash::Contributors - Stash containing list of contributors

# VERSION

version 0.1.1

# SYNOPSIS

```perl
my $contrib_stash = $self->zilla->stash_named('%Contributors');

unless ( $contrib_stash ) {
    $contrib_stash = Dist::Zilla::Stash::Contributors->new;
    $self->_register_stash('%Contributors', $contrib_stash );
}
```

$contrib\_stash->add\_contributors( 'Yanick Champoux <yanick@cpan.org>' );

# DESCRIPTION

If you are a [Dist::Zilla](https://metacpan.org/pod/Dist::Zilla) user, avert your eyes and read no more: this
module is not for general consumption but for authors of plugins dealing 
with contributors harvesting or processing.

Oh, you're one of those? Excellent. Well, here's the deal: this is a 
stash that is meant to carry the contributors' information between plugins.
Plugins that gather contributors can populate the list with code looking like
this:

```perl
sub before_build {
    my $self = shift;

    ...; # gather @collaborators, somehow

    my $contrib_stash = $self->zilla->stash_named('%Contributors');
    unless ( $contrib_stash ) {
        $contrib_stash = Dist::Zilla::Stash::Contributors->new;
        $self->_register_stash('%Contributors', $contrib_stash );
    }

    $contrib_stash->add_contributors( @contributors );
}
```

and plugin that use them:

```perl
    # of course, make sure this is run *after* the gatherers did their job
sub before_build {
    my $self = shift;

    my $contrib_stash = $self->zilla->stash_named('%Contributors')
        or return;

    my @contributors = $contrib_stash->all_contributors;
}
```

And that's pretty much all you need to know beside that, internally, each contributor is represented by 
a [Dist::Zilla::Stash::Contributors::Contributor](https://metacpan.org/pod/Dist::Zilla::Stash::Contributors::Contributor) object.

# METHODS

## all\_contributors()

Returns all contributors as `Dist::Zilla::Stash::Contributors::Contributor`
objects. The collaborators are sorted alphabetically.

## nbr\_contributors()

Returns the number of contributors.

## add\_contributors( @contributors )

Adds the `@contributors` to the stash. Duplicates are filtered out. 

Contributors can be [Dist::Zilla::Stash::Contributors::Contributor](https://metacpan.org/pod/Dist::Zilla::Stash::Contributors::Contributor) objects
or strings of the format 'Full Name <email@address.org>'.

# AUTHOR

Yanick Champoux <yanick@cpan.org> [![endorse](http://api.coderwall.com/yanick/endorsecount.png)](http://coderwall.com/yanick)

# COPYRIGHT AND LICENSE

This software is copyright (c) 2019, 2013 by Yanick Champoux.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
