File Coverage

blib/lib/SBOM/CycloneDX/Standard.pm
Criterion Covered Total %
statement 29 44 65.9
branch 0 18 0.0
condition n/a
subroutine 10 11 90.9
pod 1 1 100.0
total 40 74 54.0


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Standard;
2              
3 1     1   1670 use 5.010001;
  1         4  
4 1     1   4 use strict;
  1         3  
  1         18  
5 1     1   4 use warnings;
  1         1  
  1         50  
6 1     1   5 use utf8;
  1         1  
  1         9  
7              
8 1     1   22 use SBOM::CycloneDX::BomRef;
  1         1  
  1         17  
9 1     1   3 use SBOM::CycloneDX::List;
  1         1  
  1         37  
10              
11 1     1   4 use Types::Standard qw(Str InstanceOf HashRef);
  1         1  
  1         10  
12 1     1   2825 use Types::TypeTiny qw(ArrayLike);
  1         3  
  1         8  
13              
14 1     1   408 use Moo;
  1         2  
  1         8  
15 1     1   452 use namespace::autoclean;
  1         4  
  1         17  
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             has name => (is => 'rw', isa => Str);
26             has version => (is => 'rw', isa => Str);
27             has description => (is => 'rw', isa => Str);
28             has owner => (is => 'rw', isa => Str);
29              
30             has requirements => (
31             is => 'rw',
32             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Standard::Requirement']],
33             default => sub { SBOM::CycloneDX::List->new }
34             );
35              
36             has levels => (
37             is => 'rw',
38             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Standard::Level']],
39             default => sub { SBOM::CycloneDX::List->new }
40             );
41              
42             has external_references => (
43             is => 'rw',
44             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::ExternalReference']],
45             default => sub { SBOM::CycloneDX::List->new }
46             );
47              
48             has signature => (is => 'rw', isa => HashRef);
49              
50             sub TO_JSON {
51              
52 0     0 1   my $self = shift;
53              
54 0           my $json = {};
55              
56 0 0         $json->{'bom-ref'} = $self->bom if $self->bom_ref;
57 0 0         $json->{name} = $self->name if $self->name;
58 0 0         $json->{version} = $self->version if $self->version;
59 0 0         $json->{description} = $self->description if $self->description;
60 0 0         $json->{owner} = $self->owner if $self->owner;
61 0 0         $json->{requirements} = $self->requirements if @{$self->requirements};
  0            
62 0 0         $json->{levels} = $self->levels if @{$self->levels};
  0            
63 0 0         $json->{externalReferences} = $self->external_references if @{$self->external_references};
  0            
64 0 0         $json->{signature} = $self->signature if $self->signature;
65              
66 0           return $json;
67              
68             }
69              
70             1;
71              
72             =encoding utf-8
73              
74             =head1 NAME
75              
76             SBOM::CycloneDX::Standard - Standard
77              
78             =head1 SYNOPSIS
79              
80             SBOM::CycloneDX::Standard->new();
81              
82              
83             =head1 DESCRIPTION
84              
85             A standard may consist of regulations, industry or organizational-specific
86             standards, maturity models, best practices, or any other requirements which can
87             be evaluated against or attested to.
88              
89             =head2 METHODS
90              
91             L inherits all methods from L
92             and implements the following new ones.
93              
94             =over
95              
96             =item SBOM::CycloneDX::Standard->new( %PARAMS )
97              
98             Properties:
99              
100             =over
101              
102             =item * C, An identifier which can be used to reference the
103             object elsewhere in the BOM. Every bom-ref must be unique within the BOM.
104              
105             =item * C, The description of the standard.
106              
107             =item * C, External references provide a way to document
108             systems, sites, and information that may be relevant but are not included
109             with the BOM. They may also establish specific relationships within or
110             external to the BOM.
111              
112             =item * C, The list of levels associated with the standard. Some
113             standards have different levels of compliance.
114              
115             =item * C, The name of the standard. This will often be a shortened,
116             single name of the standard.
117              
118             =item * C, The owner of the standard, often the entity responsible for
119             its release.
120              
121             =item * C, The list of requirements comprising the standard.
122              
123             =item * C, Enveloped signature in [JSON Signature Format
124             (JSF)](https://cyberphone.github.io/doc/security/jsf.html).
125              
126             =item * C, The version of the standard.
127              
128             =back
129              
130             =item $standard->bom_ref
131              
132             =item $standard->description
133              
134             =item $standard->external_references
135              
136             =item $standard->levels
137              
138             =item $standard->name
139              
140             =item $standard->owner
141              
142             =item $standard->requirements
143              
144             =item $standard->signature
145              
146             =item $standard->version
147              
148             =back
149              
150              
151             =head1 SUPPORT
152              
153             =head2 Bugs / Feature Requests
154              
155             Please report any bugs or feature requests through the issue tracker
156             at L.
157             You will be notified automatically of any progress on your issue.
158              
159             =head2 Source Code
160              
161             This is open source software. The code repository is available for
162             public review and contribution under the terms of the license.
163              
164             L
165              
166             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
167              
168              
169             =head1 AUTHOR
170              
171             =over 4
172              
173             =item * Giuseppe Di Terlizzi
174              
175             =back
176              
177              
178             =head1 LICENSE AND COPYRIGHT
179              
180             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
181              
182             This is free software; you can redistribute it and/or modify it under
183             the same terms as the Perl 5 programming language system itself.
184              
185             =cut