Contributors.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 1 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 7 / 7 Podpod 100% 2 / 2 totaltotal 90.9% 40 / 44 CC 4 SCAR 8.0
CC
4
Cov
94%
add_contributors
4.1
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
↑ Summary Contributors/Contributor.pm »
1 package Dist::Zilla::Stash::Contributors;
2 2 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: Stash containing list of contributors
4 2 $Dist::Zilla::Stash::Contributors::VERSION = '0.1.1';
5 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Dist::Zilla::Stash::Contributors::Contributor;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 has contributors => (
13 traits => [ 'Hash' ],
14 isa => 'HashRef[Dist::Zilla::Stash::Contributors::Contributor]',
15 is => 'ro',
16 1 ▶ default => sub { {} },
Subroutine __ANON__: called CC=1 SCAR=0.0
17 2 handles => {
18 _all_contributors => 'values',
19 nbr_contributors => 'count',
20 },
21 );
22  
23  
24 2 ▶sub all_contributors {
Subroutine all_contributors: called CC=1 SCAR=0.0
Pod documented
25 2 my $self = shift;
26  
27 2 return sort { $a->stringify cmp $b->stringify } $self->_all_contributors;
28 }
29  
30  
31 1 ▶sub add_contributors {
Subroutine add_contributors: called CC=4 SCAR=14.0
Pod documented
32 1 my ( $self, @contributors ) = @_;
33  
34 1 for my $c ( @contributors ) {
35 3 my $name = $c;
36 3 my $email;
37 3 ▶ $email = $1 if $name =~ s/\s*<(.*?)>\s*//;
Branch: 1 branch
BranchTrueFalseTotal
if $name =~ s/\s*<(.*?)>\s*// 3 0 3
38  
39 3 my $object = Dist::Zilla::Stash::Contributors::Contributor->new(
40 name => $name, email => $email
41 );
42  
43 3 ▶ $self->contributors->{ $object->stringify } ||= $object;
Condition66%2/3
$self->contributors->{$object->stringify} ||= $object
l!l&&r!l&&!r
120
MC/DC0%0/2
$self->contributors->{$object->stringify} ||= $object
$self->contributors->{$object->stringify} $object
Truth table66%2/3
A ||= B
A= $self->contributors->{$object->stringify}B= $object
ABresult
1X1
011
000
44 }
45  
46 }
47  
48 2 __PACKAGE__->meta->make_immutable;
49  
50 2 1;
51  
52 __END__
↑ Summary Contributors/Contributor.pm »