File Coverage

blib/lib/Dist/Zooky/License.pm
Criterion Covered Total %
statement 22 28 78.5
branch 0 4 0.0
condition 0 3 0.0
subroutine 7 7 100.0
pod n/a
total 29 42 69.0


line stmt bran cond sub pod time code
1             package Dist::Zooky::License;
2             $Dist::Zooky::License::VERSION = '0.22';
3             # ABSTRACT: license objects for Dist::Zooky
4              
5 1     1   698 use strict;
  1         2  
  1         24  
6 1     1   3 use warnings;
  1         1  
  1         46  
7 1     1   499 use Module::Pluggable search_path => 'Software::License', except => qr/(Custom)$/;
  1         8287  
  1         8  
8 1     1   494 use Class::Load ();
  1         10614  
  1         25  
9 1     1   514 use Moose;
  1         307096  
  1         8  
10              
11             has 'metaname' => (
12             is => 'ro',
13             isa => 'Str',
14             required => 1,
15             );
16              
17             has 'license' => (
18             is => 'ro',
19             isa => 'ArrayRef[Software::License]',
20             lazy => 1,
21             builder => '_build_license',
22             init_arg => undef,
23             );
24              
25             sub _build_license {
26 3     3   2 my $self = shift;
27 3         4 my @licenses;
28 3         10 foreach my $plugin ( $self->plugins ) {
29 0         0 Class::Load::load_class( $plugin );
30 0         0 my $license;
31 0         0 eval {
32 0         0 $license = $plugin->new({ holder => 'noddy' }); # need to set holder
33             };
34 0 0       0 next if $@;
35 0 0 0     0 push @licenses, $license
36             if $license->meta2_name eq $self->metaname
37             or $license->meta_name eq $self->metaname;
38             }
39 3         765 return \@licenses;
40             }
41              
42             __PACKAGE__->meta->make_immutable;
43 1     1   5646 no Moose;
  1         2  
  1         4  
44              
45             qq[Licenses];
46              
47             __END__
48              
49             =pod
50              
51             =encoding UTF-8
52              
53             =head1 NAME
54              
55             Dist::Zooky::License - license objects for Dist::Zooky
56              
57             =head1 VERSION
58              
59             version 0.22
60              
61             =head1 AUTHOR
62              
63             Chris Williams <chris@bingosnet.co.uk>
64              
65             =head1 COPYRIGHT AND LICENSE
66              
67             This software is copyright (c) 2017 by Chris Williams.
68              
69             This is free software; you can redistribute it and/or modify it under
70             the same terms as the Perl 5 programming language system itself.
71              
72             =cut