CycloneDX/License/Licensing.pm

filter: Statementstmt 97.1% 69 / 71 Branchbran 40.0% 8 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 90.4% 19 / 21 Podpod 100% 1 / 1 totaltotal 85.8% 97 / 113 CC 11 SCAR 14.7
CC
11
Cov
85%
TO_JSON
10.3
__ANON__
6.0
__ANON__
6.0
CRAP 4.3
« CycloneDX/CryptoProperties/RelatedCryptographicAsset.pm ↑ Summary CycloneDX/Component/Diff.pm »
1 package SBOM::CycloneDX::License::Licensing;
2  
3 16 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use SBOM::CycloneDX::Enum;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use SBOM::CycloneDX::License::Licensee;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 16 ▶use SBOM::CycloneDX::License::Licensor;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 16 ▶use SBOM::CycloneDX::License::Purchaser;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 16 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 16 ▶use Types::Standard qw(Str Enum InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 16 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 16 extends 'SBOM::CycloneDX::Base';
21  
22 22 ▶has alt_ids => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: called CC=1 SCAR=0.0
23  
24 has licensor => (
25 is => 'rw',
26 isa => InstanceOf ['SBOM::CycloneDX::License::Licensor'],
27 22 ▶ default => sub { SBOM::CycloneDX::License::Licensor->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
28 16 );
29  
30 has licensee => (
31 is => 'rw',
32 isa => InstanceOf ['SBOM::CycloneDX::License::Licensee'],
33 22 ▶ default => sub { SBOM::CycloneDX::License::Licensee->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
34 16 );
35  
36 has purchaser => (
37 is => 'rw',
38 isa => InstanceOf ['SBOM::CycloneDX::License::Purchaser'],
39 22 ▶ default => sub { SBOM::CycloneDX::License::Purchaser->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
40 16 );
41  
42 16 has purchase_order => (is => 'rw', isa => Str);
43  
44 has license_types => (
45 is => 'rw',
46 isa => ArrayLike [Enum [SBOM::CycloneDX::Enum->values('LICENSE_TYPE')]],
47 22 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
48 16 );
49  
50 has last_renewal => (
51 is => 'rw',
52 isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
53 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
54 16 );
55  
56 has expiration => (
57 is => 'rw',
58 isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
59 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
60 16 );
61  
62 53 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=9 SCAR=23.3
Pod documented
63  
64 53 my $self = shift;
65  
66 53 my $json = {};
67  
68 53 ▶ $json->{altIds} = $self->alt_ids if @{$self->alt_ids};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->alt_ids;} 0 53 53
69 53 ▶ $json->{licensor} = $self->licensor if %{$self->licensor->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->licensor->TO_JSON;} 0 53 53
70 53 ▶ $json->{licensee} = $self->licensee if %{$self->licensee->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->licensee->TO_JSON;} 0 53 53
71 53 ▶ $json->{purchaser} = $self->purchaser if %{$self->purchaser->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->purchaser->TO_JSON;} 0 53 53
72 53 ▶ $json->{purchaseOrder} = $self->purchase_order if $self->purchase_order;
Branch: 1 branch
BranchTrueFalseTotal
if $self->purchase_order 0 53 53
73 53 ▶ $json->{licenseTypes} = $self->license_types if @{$self->license_types};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->license_types;} 0 53 53
74 53 ▶ $json->{lastRenewal} = $self->last_renewal if $self->last_renewal;
Branch: 1 branch
BranchTrueFalseTotal
if $self->last_renewal 0 53 53
75 53 ▶ $json->{expiration} = $self->expiration if $self->expiration;
Branch: 1 branch
BranchTrueFalseTotal
if $self->expiration 0 53 53
76  
77 53 return $json;
78  
79 }
80  
81 16 1;
82  
83 =encoding utf-8
84  
85 =head1 NAME
86  
87 SBOM::CycloneDX::License::Licensing - Licensing information
88  
89 =head1 SYNOPSIS
90  
91 SBOM::CycloneDX::License::Licensing->new();
92  
93  
94 =head1 DESCRIPTION
95  
96 L<SBOM::CycloneDX::License::Licensing> provides the licensing details describing the
97 licensor/licensee, license type, renewal and expiration dates, and other
98 important metadata
99  
100 =head2 METHODS
101  
102 L<SBOM::CycloneDX::License::Licensing> inherits all methods from L<SBOM::CycloneDX::Base>
103 and implements the following new ones.
104  
105 =over
106  
107 =item SBOM::CycloneDX::License::Licensing->new( %PARAMS )
108  
109 Properties:
110  
111 =over
112  
113 =item * C<alt_ids>, License identifiers that may be used to manage licenses
114 and their lifecycle
115  
116 =item * C<expiration>, The timestamp indicating when the current license
117 expires (if applicable).
118  
119 =item * C<last_renewal>, The timestamp indicating when the license was last
120 renewed. For new purchases, this is often the purchase or acquisition date.
121 For non-perpetual licenses or subscriptions, this is the timestamp of when
122 the license was last renewed.
123  
124 =item * C<license_types>, The type of license(s) that was granted to the
125 licensee.
126  
127 =item * C<licensee>, The individual or organization for which a license was
128 granted to
129  
130 =item * C<licensor>, The individual or organization that grants a license to
131 another individual or organization
132  
133 =item * C<purchase_order>, The purchase order identifier the purchaser sent
134 to a supplier or vendor to authorize a purchase
135  
136 =item * C<purchaser>, The individual or organization that purchased the
137 license
138  
139 =back
140  
141 =item $licensing->alt_ids
142  
143 =item $licensing->expiration
144  
145 =item $licensing->last_renewal
146  
147 =item $licensing->license_types
148  
149 =item $licensing->licensee
150  
151 =item $licensing->licensor
152  
153 =item $licensing->purchase_order
154  
155 =item $licensing->purchaser
156  
157 =back
158  
159  
160 =head1 SUPPORT
161  
162 =head2 Bugs / Feature Requests
163  
164 Please report any bugs or feature requests through the issue tracker
165 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
166 You will be notified automatically of any progress on your issue.
167  
168 =head2 Source Code
169  
170 This is open source software. The code repository is available for
171 public review and contribution under the terms of the license.
172  
173 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
174  
175 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
176  
177  
178 =head1 AUTHOR
179  
180 =over 4
181  
182 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
183  
184 =back
185  
186  
187 =head1 LICENSE AND COPYRIGHT
188  
189 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
190  
191 This is free software; you can redistribute it and/or modify it under
192 the same terms as the Perl 5 programming language system itself.
193  
194 =cut
« CycloneDX/CryptoProperties/RelatedCryptographicAsset.pm ↑ Summary CycloneDX/Component/Diff.pm »