CycloneDX/Declarations.pm

filter: Statementstmt 100% 50 / 50 Branchbran 50.0% 7 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod 100% 1 / 1 totaltotal 91.0% 71 / 78 CC 8 SCAR 14.4
CC
8
Cov
89%
TO_JSON
9.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.2
« CycloneDX/Source.pm ↑ Summary CycloneDX/Lite.pm »
1 package SBOM::CycloneDX::Declarations;
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 Types::Standard qw(Str InstanceOf HashRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 16 extends 'SBOM::CycloneDX::Base';
15  
16 has assessors => (
17 is => 'rw',
18 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Assessor']],
19 57 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
20 16 );
21  
22 has attestations => (
23 is => 'rw',
24 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Attastation']],
25 57 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
26 16 );
27  
28 has claims => (
29 is => 'rw',
30 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Claim']],
31 57 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
32 16 );
33  
34 has evidence => (
35 is => 'rw',
36 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Evidence']],
37 57 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
38 16 );
39  
40 16 has targets => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Declarations::Targets']);
41 16 has affirmation => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Declarations::Affirmation']);
42 16 has signature => (is => 'rw', isa => HashRef);
43  
44 138 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=8 SCAR=22.0
Pod documented
45  
46 138 my $self = shift;
47  
48 138 my $json = {};
49  
50 138 ▶ $json->{assessors} = $self->assessors if @{$self->assessors};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->assessors;} 0 138 138
51 138 ▶ $json->{attestations} = $self->attestations if @{$self->attestations};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->attestations;} 0 138 138
52 138 ▶ $json->{claims} = $self->claims if @{$self->claims};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->claims;} 0 138 138
53 138 ▶ $json->{evidence} = $self->evidence if @{$self->evidence};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->evidence;} 0 138 138
54 138 ▶ $json->{targets} = $self->targets if $self->targets;
Branch: 1 branch
BranchTrueFalseTotal
if $self->targets 0 138 138
55 138 ▶ $json->{affirmation} = $self->affirmation if $self->affirmation;
Branch: 1 branch
BranchTrueFalseTotal
if $self->affirmation 0 138 138
56 138 ▶ $json->{signature} = $self->signature if $self->signature;
Branch: 1 branch
BranchTrueFalseTotal
if $self->signature 0 138 138
57  
58 138 return $json;
59  
60 }
61  
62 16 1;
63  
64 =encoding utf-8
65  
66 =head1 NAME
67  
68 SBOM::CycloneDX::Declarations - Declarations
69  
70 =head1 SYNOPSIS
71  
72 SBOM::CycloneDX::Declarations->new();
73  
74  
75 =head1 DESCRIPTION
76  
77 L<SBOM::CycloneDX::Declarations> provides the list of declarations which describe
78 the conformance to standards. Each declaration may include attestations,
79 claims, and evidence.
80  
81 =head2 METHODS
82  
83 L<SBOM::CycloneDX::Declarations> inherits all methods from L<SBOM::CycloneDX::Base>
84 and implements the following new ones.
85  
86 =over
87  
88 =item SBOM::CycloneDX::Declarations->new( %PARAMS )
89  
90 Properties:
91  
92 =over
93  
94 =item * C<affirmation>, A concise statement affirmed by an individual
95 regarding all declarations, often used for third-party auditor acceptance
96 or recipient acknowledgment. It includes a list of authorized signatories
97 who assert the validity of the document on behalf of the organization.
98  
99 =item * C<assessors>, The list of assessors evaluating claims and determining
100 conformance to requirements and confidence in that assessment.
101  
102 =item * C<attestations>, The list of attestations asserted by an assessor
103 that maps requirements to claims.
104  
105 =item * C<claims>, The list of claims.
106  
107 =item * C<evidence>, The list of evidence
108  
109 =item * C<signature>, Enveloped signature in JSON Signature Format
110 (JSF) (L<https://cyberphone.github.io/doc/security/jsf.html>).
111  
112 =item * C<targets>, The list of targets which claims are made against.
113  
114 =back
115  
116 =item $declarations->affirmation
117  
118 =item $declarations->assessors
119  
120 =item $declarations->attestations
121  
122 =item $declarations->claims
123  
124 =item $declarations->evidence
125  
126 =item $declarations->signature
127  
128 =item $declarations->targets
129  
130 =back
131  
132  
133 =head1 SUPPORT
134  
135 =head2 Bugs / Feature Requests
136  
137 Please report any bugs or feature requests through the issue tracker
138 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
139 You will be notified automatically of any progress on your issue.
140  
141 =head2 Source Code
142  
143 This is open source software. The code repository is available for
144 public review and contribution under the terms of the license.
145  
146 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
147  
148 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
149  
150  
151 =head1 AUTHOR
152  
153 =over 4
154  
155 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
156  
157 =back
158  
159  
160 =head1 LICENSE AND COPYRIGHT
161  
162 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
163  
164 This is free software; you can redistribute it and/or modify it under
165 the same terms as the Perl 5 programming language system itself.
166  
167 =cut
« CycloneDX/Source.pm ↑ Summary CycloneDX/Lite.pm »