File Coverage

blib/lib/SBOM/CycloneDX/Declarations.pm
Criterion Covered Total %
statement 37 37 100.0
branch 7 14 50.0
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 54 61 88.5


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Declarations;
2              
3 16     16   372 use 5.010001;
  16         74  
4 16     16   106 use strict;
  16         36  
  16         492  
5 16     16   96 use warnings;
  16         31  
  16         1175  
6 16     16   119 use utf8;
  16         66  
  16         123  
7              
8 16     16   704 use Types::Standard qw(Str InstanceOf HashRef);
  16         36  
  16         123  
9 16     16   54879 use Types::TypeTiny qw(ArrayLike);
  16         50  
  16         117  
10              
11 16     16   10888 use Moo;
  16         23679  
  16         140  
12 16     16   20448 use namespace::autoclean;
  16         343105  
  16         98  
13              
14             extends 'SBOM::CycloneDX::Base';
15              
16             has assessors => (
17             is => 'rw',
18             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Assessor']],
19             default => sub { SBOM::CycloneDX::List->new }
20             );
21              
22             has attestations => (
23             is => 'rw',
24             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Attastation']],
25             default => sub { SBOM::CycloneDX::List->new }
26             );
27              
28             has claims => (
29             is => 'rw',
30             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Claim']],
31             default => sub { SBOM::CycloneDX::List->new }
32             );
33              
34             has evidence => (
35             is => 'rw',
36             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Evidence']],
37             default => sub { SBOM::CycloneDX::List->new }
38             );
39              
40             has targets => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Declarations::Targets']);
41             has affirmation => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Declarations::Affirmation']);
42             has signature => (is => 'rw', isa => HashRef);
43              
44             sub TO_JSON {
45              
46 356     356 1 3558 my $self = shift;
47              
48 356         825 my $json = {};
49              
50 356 50       553 $json->{assessors} = $self->assessors if @{$self->assessors};
  356         7607  
51 356 50       720 $json->{attestations} = $self->attestations if @{$self->attestations};
  356         7626  
52 356 50       641 $json->{claims} = $self->claims if @{$self->claims};
  356         7652  
53 356 50       665 $json->{evidence} = $self->evidence if @{$self->evidence};
  356         7390  
54 356 50       7271 $json->{targets} = $self->targets if $self->targets;
55 356 50       9488 $json->{affirmation} = $self->affirmation if $self->affirmation;
56 356 50       9284 $json->{signature} = $self->signature if $self->signature;
57              
58 356         3480 return $json;
59              
60             }
61              
62             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 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 inherits all methods from L
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, 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, The list of assessors evaluating claims and determining
100             conformance to requirements and confidence in that assessment.
101              
102             =item * C, The list of attestations asserted by an assessor
103             that maps requirements to claims.
104              
105             =item * C, The list of claims.
106              
107             =item * C, The list of evidence
108              
109             =item * C, Enveloped signature in JSON Signature Format
110             (JSF) (L).
111              
112             =item * C, 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.
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
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
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