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   210 use 5.010001;
  16         49  
4 16     16   75 use strict;
  16         29  
  16         399  
5 16     16   58 use warnings;
  16         45  
  16         624  
6 16     16   76 use utf8;
  16         27  
  16         73  
7              
8 16     16   6596 use SBOM::CycloneDX::OrganizationalEntity;
  16         69  
  16         575  
9 16     16   8449 use SBOM::CycloneDX::OrganizationalContact;
  16         57  
  16         578  
10              
11 16     16   97 use Types::Standard qw(InstanceOf);
  16         28  
  16         78  
12              
13 16     16   18080 use Moo;
  16         32  
  16         85  
14 16     16   4795 use namespace::autoclean;
  16         51  
  16         99  
15              
16             extends 'SBOM::CycloneDX::Base';
17              
18             sub BUILD {
19 66     66 0 2112 my ($self, $args) = @_;
20             Carp::croak('"organization" and "individual" cannot be used at the same time')
21 66 0 33     844 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 159     159 1 825 my $self = shift;
39              
40 159         170 my $json = {};
41              
42 159 50       157 $json->{organization} = $self->organization if %{$self->organization->TO_JSON};
  159         1648  
43 159 50       173 $json->{individual} = $self->individual if %{$self->individual->TO_JSON};
  159         1750  
44              
45 159         357 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