File Coverage

blib/lib/Dist/Zooky/DistIni/Resources.pm
Criterion Covered Total %
statement 14 27 51.8
branch 1 8 12.5
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 41 51.2


line stmt bran cond sub pod time code
1             package Dist::Zooky::DistIni::Resources;
2             $Dist::Zooky::DistIni::Resources::VERSION = '0.24';
3             # ABSTRACT: Dist::Zooky DistIni plugin to write MetaResources
4              
5 2     2   1052 use strict;
  2         5  
  2         56  
6 2     2   9 use warnings;
  2         4  
  2         58  
7 2     2   10 use Moose;
  2         2  
  2         14  
8              
9             with 'Dist::Zooky::Role::DistIni';
10              
11             sub content {
12 2     2 1 4 my $self = shift;
13 2 50       53 return unless my $resources = $self->metadata->{resources};
14 0           my $content = "[MetaResources]\n";
15 0           foreach my $type ( keys %{ $resources } ) {
  0            
16 0 0         next if $type eq 'license';
17 0           my $ref = ref $resources->{$type};
18 0 0         if ( $ref eq 'HASH' ) {
    0          
19 0           foreach my $item ( keys %{ $resources->{$type} } ) {
  0            
20 0           $content .= "$type.$item = " . $resources->{$type}->{$item} . "\n";
21             }
22             }
23             elsif ( $ref eq 'ARRAY' ) {
24 0           $content .= "$type = $_\n" for @{ $resources->{$type} };
  0            
25             }
26             else {
27 0           $content .= "$type = " . $resources->{$type} . "\n";
28             }
29             }
30 0           return $content;
31             }
32              
33             __PACKAGE__->meta->make_immutable;
34 2     2   12545 no Moose;
  2         6  
  2         14  
35              
36             1;
37              
38             __END__
39              
40             =pod
41              
42             =encoding UTF-8
43              
44             =head1 NAME
45              
46             Dist::Zooky::DistIni::Resources - Dist::Zooky DistIni plugin to write MetaResources
47              
48             =head1 VERSION
49              
50             version 0.24
51              
52             =head1 METHODS
53              
54             =over
55              
56             =item C<content>
57              
58             Returns C<content> for adding to C<dist.ini>.
59              
60             =back
61              
62             =head1 AUTHOR
63              
64             Chris Williams <chris@bingosnet.co.uk>
65              
66             =head1 COPYRIGHT AND LICENSE
67              
68             This software is copyright (c) 2017 by Chris Williams.
69              
70             This is free software; you can redistribute it and/or modify it under
71             the same terms as the Perl 5 programming language system itself.
72              
73             =cut