File Coverage

blib/lib/SBOM/CycloneDX/Declarations/Evidence.pm
Criterion Covered Total %
statement 32 45 71.1
branch 0 18 0.0
condition n/a
subroutine 11 12 91.6
pod 1 1 100.0
total 44 76 57.8


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Declarations::Evidence;
2              
3 1     1   1412 use 5.010001;
  1         4  
4 1     1   5 use strict;
  1         1  
  1         28  
5 1     1   9 use warnings;
  1         3  
  1         51  
6 1     1   4 use utf8;
  1         2  
  1         9  
7              
8 1     1   28 use SBOM::CycloneDX::BomRef;
  1         1  
  1         23  
9 1     1   4 use SBOM::CycloneDX::Timestamp;
  1         1  
  1         572  
10 1     1   7 use SBOM::CycloneDX::Declarations::Data;
  1         2  
  1         23  
11              
12 1     1   3 use Types::Standard qw(Str InstanceOf HashRef);
  1         2  
  1         9  
13 1     1   2629 use Types::TypeTiny qw(ArrayLike);
  1         3  
  1         8  
14              
15 1     1   415 use Moo;
  1         3  
  1         11  
16 1     1   384 use namespace::autoclean;
  1         2  
  1         14  
17              
18             extends 'SBOM::CycloneDX::Base';
19              
20             has bom_ref => (
21             is => 'rw',
22             isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
23             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
24             );
25              
26             has property_name => (is => 'rw', isa => Str);
27             has description => (is => 'rw', isa => Str);
28              
29             has data => (
30             is => 'rw',
31             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Declarations::Data']],
32             default => sub { SBOM::CycloneDX::Declarations::Data->new }
33             );
34              
35             has created => (
36             is => 'rw',
37             isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
38             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
39             );
40              
41             has expires => (
42             is => 'rw',
43             isa => InstanceOf ['SBOM::CycloneDX::Timestamp'],
44             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) }
45             );
46              
47             has author => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact']);
48             has reviewer => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact']);
49             has signature => (is => 'rw', isa => HashRef);
50              
51             sub TO_JSON {
52              
53 0     0 1   my $self = shift;
54              
55 0           my $json = {};
56              
57 0 0         $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
58 0 0         $json->{propertyName} = $self->property_name if $self->property_name;
59 0 0         $json->{description} = $self->description if $self->description;
60 0 0         $json->{data} = $self->data if @{$self->data};
  0            
61 0 0         $json->{created} = $self->created if $self->created;
62 0 0         $json->{expires} = $self->expires if $self->expires;
63 0 0         $json->{author} = $self->author if $self->author;
64 0 0         $json->{reviewer} = $self->reviewer if $self->reviewer;
65 0 0         $json->{signature} = $self->signature if $self->signature;
66              
67 0           return $json;
68              
69             }
70              
71             1;
72              
73             =encoding utf-8
74              
75             =head1 NAME
76              
77             SBOM::CycloneDX::Declarations::Evidence - Evidence
78              
79             =head1 SYNOPSIS
80              
81             SBOM::CycloneDX::Declarations::Evidence->new();
82              
83              
84             =head1 DESCRIPTION
85              
86             L provides the evidence object.
87              
88             =head2 METHODS
89              
90             L inherits all methods from L
91             and implements the following new ones.
92              
93             =over
94              
95             =item SBOM::CycloneDX::Declarations::Evidence->new( %PARAMS )
96              
97             Properties:
98              
99             =over
100              
101             =item * C, The author of the evidence.
102              
103             =item * C, An identifier which can be used to reference the object
104             elsewhere in the BOM. Every C must be unique within the BOM.
105              
106             =item * C, The date and time (timestamp) when the evidence was
107             created.
108              
109             =item * C, The output or analysis that supports claims.
110              
111             =item * C, The written description of what this evidence is and
112             how it was created.
113              
114             =item * C, The date and time (timestamp) when the evidence is no
115             longer valid.
116              
117             =item * C, The reference to the property name as defined in
118             the CycloneDX Property Taxonomy (L).
119              
120             =item * C, The reviewer of the evidence.
121              
122             =item * C, Enveloped signature in JSON Signature Format (JSF)
123             (L).
124              
125             =back
126              
127             =item $evidence->author
128              
129             =item $evidence->bom_ref
130              
131             =item $evidence->created
132              
133             =item $evidence->data
134              
135             =item $evidence->description
136              
137             =item $evidence->expires
138              
139             =item $evidence->property_name
140              
141             =item $evidence->reviewer
142              
143             =item $evidence->signature
144              
145             =back
146              
147              
148             =head1 SUPPORT
149              
150             =head2 Bugs / Feature Requests
151              
152             Please report any bugs or feature requests through the issue tracker
153             at L.
154             You will be notified automatically of any progress on your issue.
155              
156             =head2 Source Code
157              
158             This is open source software. The code repository is available for
159             public review and contribution under the terms of the license.
160              
161             L
162              
163             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
164              
165              
166             =head1 AUTHOR
167              
168             =over 4
169              
170             =item * Giuseppe Di Terlizzi
171              
172             =back
173              
174              
175             =head1 LICENSE AND COPYRIGHT
176              
177             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
178              
179             This is free software; you can redistribute it and/or modify it under
180             the same terms as the Perl 5 programming language system itself.
181              
182             =cut