File Coverage

blib/lib/SBOM/CycloneDX/License/Licensee.pm
Criterion Covered Total %
statement 35 35 100.0
branch 2 6 33.3
condition 1 3 33.3
subroutine 11 11 100.0
pod 1 2 50.0
total 50 57 87.7


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::License::Licensee;
2              
3 16     16   326 use 5.010001;
  16         75  
4 16     16   100 use strict;
  16         33  
  16         519  
5 16     16   126 use warnings;
  16         35  
  16         918  
6 16     16   100 use utf8;
  16         34  
  16         112  
7              
8 16     16   8739 use SBOM::CycloneDX::OrganizationalEntity;
  16         118  
  16         854  
9 16     16   10590 use SBOM::CycloneDX::OrganizationalContact;
  16         78  
  16         837  
10              
11 16     16   130 use Types::Standard qw(InstanceOf);
  16         38  
  16         112  
12              
13 16     16   25538 use Moo;
  16         61  
  16         92  
14 16     16   6442 use namespace::autoclean;
  16         41  
  16         105  
15              
16             extends 'SBOM::CycloneDX::Base';
17              
18             sub BUILD {
19 66     66 0 3557 my ($self, $args) = @_;
20             Carp::croak('"organization" and "individual" cannot be used at the same time')
21 66 0 33     1621 if exists $args->{organization} && exists $args->{individual};
22             }
23              
24             has organization => (
25             is => 'rw',
26             isa => InstanceOf ['SBOM::CycloneDX::OrganizationalEntity'],
27             default => sub { SBOM::CycloneDX::OrganizationalEntity->new }
28             );
29              
30             has individual => (
31             is => 'rw',
32             isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact'],
33             default => sub { SBOM::CycloneDX::OrganizationalContact->new }
34             );
35              
36             sub TO_JSON {
37              
38 903     903 1 6968 my $self = shift;
39              
40 903         1575 my $json = {};
41              
42 903 50       1342 $json->{organization} = $self->organization if %{$self->organization->TO_JSON};
  903         16844  
43 903 50       1712 $json->{individual} = $self->individual if %{$self->individual->TO_JSON};
  903         18101  
44              
45 903         3413 return $json;
46              
47             }
48              
49             1;
50              
51             =encoding utf-8
52              
53             =head1 NAME
54              
55             SBOM::CycloneDX::License::Licensee - Licensee
56              
57             =head1 SYNOPSIS
58              
59             SBOM::CycloneDX::License::Licensee->new();
60              
61              
62             =head1 DESCRIPTION
63              
64             L provides the individual or organization for
65             which a license was granted to
66              
67             =head2 METHODS
68              
69             L inherits all methods from L
70             and implements the following new ones.
71              
72             =over
73              
74             =item SBOM::CycloneDX::License::Licensee->new( %PARAMS )
75              
76             Properties:
77              
78             =over
79              
80             =item * C, The individual, not associated with an organization,
81             that was granted the license
82              
83             =item * C, The organization that was granted the license
84              
85             =back
86              
87             =item $licensee->individual
88              
89             =item $licensee->organization
90              
91             =back
92              
93              
94             =head1 SUPPORT
95              
96             =head2 Bugs / Feature Requests
97              
98             Please report any bugs or feature requests through the issue tracker
99             at L.
100             You will be notified automatically of any progress on your issue.
101              
102             =head2 Source Code
103              
104             This is open source software. The code repository is available for
105             public review and contribution under the terms of the license.
106              
107             L
108              
109             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
110              
111              
112             =head1 AUTHOR
113              
114             =over 4
115              
116             =item * Giuseppe Di Terlizzi
117              
118             =back
119              
120              
121             =head1 LICENSE AND COPYRIGHT
122              
123             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
124              
125             This is free software; you can redistribute it and/or modify it under
126             the same terms as the Perl 5 programming language system itself.
127              
128             =cut