File Coverage

blib/lib/SBOM/CycloneDX/Declarations/Claim.pm
Criterion Covered Total %
statement 29 46 63.0
branch 0 18 0.0
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 40 76 52.6


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Declarations::Claim;
2              
3 1     1   2285 use 5.010001;
  1         7  
4 1     1   8 use strict;
  1         4  
  1         33  
5 1     1   8 use warnings;
  1         4  
  1         85  
6 1     1   8 use utf8;
  1         3  
  1         15  
7              
8 1     1   60 use SBOM::CycloneDX::BomRef;
  1         4  
  1         48  
9 1     1   9 use SBOM::CycloneDX::List;
  1         4  
  1         45  
10              
11 1     1   8 use Types::Standard qw(Str InstanceOf HashRef);
  1         3  
  1         16  
12 1     1   4670 use Types::TypeTiny qw(ArrayLike);
  1         4  
  1         10  
13              
14 1     1   639 use Moo;
  1         3  
  1         16  
15 1     1   560 use namespace::autoclean;
  1         2  
  1         18  
16              
17             extends 'SBOM::CycloneDX::Base';
18              
19             has bom_ref => (
20             is => 'rw',
21             isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
23             );
24              
25             # Array of bom-ref
26             has target => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
27              
28             has predicate => (is => 'rw', isa => Str);
29              
30             # Array of bom-ref
31             has mitigation_strategies => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
32              
33             has reasoning => (is => 'rw', isa => Str);
34              
35             # Array of bom-ref
36             has evidence => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
37              
38             # Array of bom-ref
39             has counter_evidence => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
40              
41             has external_references => (
42             is => 'rw',
43             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::ExternalReferences']],
44             default => sub { SBOM::CycloneDX::List->new }
45             );
46              
47             has signature => (is => 'rw', isa => HashRef);
48              
49             sub TO_JSON {
50              
51 0     0 1   my $self = shift;
52              
53 0           my $json = {};
54              
55 0 0         $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
56 0 0         $json->{target} = $self->target if @{$self->target};
  0            
57 0 0         $json->{predicate} = $self->predicate if $self->predicate;
58 0 0         $json->{mitigationStrategies} = $self->mitigation_strategies if @{$self->mitigation_strategies};
  0            
59 0 0         $json->{reasoning} = $self->reasoning if $self->reasoning;
60 0 0         $json->{evidence} = $self->evidence if @{$self->evidence};
  0            
61 0 0         $json->{counterEvidence} = $self->counter_evidence if @{$self->counter_evidence};
  0            
62 0 0         $json->{externalReferences} = $self->external_references if @{$self->external_references};
  0            
63 0 0         $json->{signature} = $self->signature if $self->signature;
64              
65 0           return $json;
66              
67             }
68              
69             1;
70              
71             =encoding utf-8
72              
73             =head1 NAME
74              
75             SBOM::CycloneDX::Declarations::Claim - Claim
76              
77             =head1 SYNOPSIS
78              
79             SBOM::CycloneDX::Declarations::Claim->new();
80              
81              
82             =head1 DESCRIPTION
83              
84             L provides the claim object.
85              
86             =head2 METHODS
87              
88             L inherits all methods from L
89             and implements the following new ones.
90              
91             =over
92              
93             =item SBOM::CycloneDX::Declarations::Claim->new( %PARAMS )
94              
95             Properties:
96              
97             =over
98              
99             =item * C, An identifier which can be used to reference the object
100             elsewhere in the BOM. Every C must be unique within the BOM.
101              
102             =item * C, The list of `bom-ref` to counterEvidence that
103             supports this claim.
104              
105             =item * C, The list of `bom-ref` to evidence that supports this
106             claim.
107              
108             =item * C, External references provide a way to document
109             systems, sites, and information that may be relevant but are not included
110             with the BOM. They may also establish specific relationships within or
111             external to the BOM.
112              
113             =item * C, The list of `bom-ref` to the evidence
114             provided describing the mitigation strategies. Each mitigation strategy
115             should include an explanation of how any weaknesses in the evidence will be
116             mitigated.
117              
118             =item * C, The specific statement or assertion about the target.
119              
120             =item * C, The written explanation of why the evidence provided
121             substantiates the claim.
122              
123             =item * C, Enveloped signature in JSON Signature Format (JSF)
124             (L).
125              
126             =item * C, The `bom-ref` to a target representing a specific system,
127             application, API, module, team, person, process, business unit, company,
128             etc... that this claim is being applied to.
129              
130             =back
131              
132             =item $claim->bom_ref
133              
134             =item $claim->counter_evidence
135              
136             =item $claim->evidence
137              
138             =item $claim->external_references
139              
140             =item $claim->mitigation_strategies
141              
142             =item $claim->predicate
143              
144             =item $claim->reasoning
145              
146             =item $claim->signature
147              
148             =item $claim->target
149              
150             =back
151              
152              
153             =head1 SUPPORT
154              
155             =head2 Bugs / Feature Requests
156              
157             Please report any bugs or feature requests through the issue tracker
158             at L.
159             You will be notified automatically of any progress on your issue.
160              
161             =head2 Source Code
162              
163             This is open source software. The code repository is available for
164             public review and contribution under the terms of the license.
165              
166             L
167              
168             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
169              
170              
171             =head1 AUTHOR
172              
173             =over 4
174              
175             =item * Giuseppe Di Terlizzi
176              
177             =back
178              
179              
180             =head1 LICENSE AND COPYRIGHT
181              
182             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
183              
184             This is free software; you can redistribute it and/or modify it under
185             the same terms as the Perl 5 programming language system itself.
186              
187             =cut