CycloneDX/Formulation.pm

filter: Statementstmt 66.0% 33 / 50 Branchbran 0.0% 0 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 9 / 15 Podpod 100% 1 / 1 totaltotal 55.1% 43 / 78 CC 7 SCAR 25.9
CC
7
Cov
53%
TO_JSON
42.0
__ANON__
6.0
__ANON__
2.0
CRAP 13.4
« CycloneDX/PatentAssertion.pm ↑ Summary CycloneDX/Declarations/Attestation.pm »
1 package SBOM::CycloneDX::Formulation;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Types::Standard qw(Str InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 1 extends 'SBOM::CycloneDX::Base';
17  
18 has bom_ref => (
19 is => 'rw',
20 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
21 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
22 1 );
23  
24 has components => (
25 is => 'rw',
26 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Component']],
27 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
28 1 );
29  
30 has services => (
31 is => 'rw',
32 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Service']],
33 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 1 );
35  
36 has workflows => (
37 is => 'rw',
38 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Workflow']],
39 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
40 1 );
41  
42 has properties => (
43 is => 'rw',
44 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Property']],
45 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
46 1 );
47  
48 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=6 SCAR=37.4
Pod documented
49  
50 0 my $self = shift;
51  
52 0 my $json = {};
53  
54 0 ▶ $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom_ref 0 0 0
55 0 ▶ $json->{components} = $self->components if @{$self->components};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->components;} 0 0 0
56 0 ▶ $json->{services} = $self->services if @{$self->services};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->services;} 0 0 0
57 0 ▶ $json->{workflows} = $self->workflows if @{$self->workflows};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->workflows;} 0 0 0
58 0 ▶ $json->{properties} = $self->properties if @{$self->properties};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->properties;} 0 0 0
59  
60 0 return $json;
61  
62 }
63  
64 1 1;
65  
66 =encoding utf-8
67  
68 =head1 NAME
69  
70 SBOM::CycloneDX::Formulation - Formula
71  
72 =head1 SYNOPSIS
73  
74 SBOM::CycloneDX::Formulation->new();
75  
76  
77 =head1 DESCRIPTION
78  
79 L<SBOM::CycloneDX::Formulation> describes the formulation of any referencable
80 object within the BOM, including components, services, metadata, declarations,
81 or the BOM itself. This may encompass how the object was created, assembled,
82 deployed, tested, certified, or otherwise brought into its present form. Common
83 examples include software build pipelines, deployment processes, AI/ML model
84 training, cryptographic key generation or certification, and third-party
85 audits. Processes are modeled using declared and observed formulas, composed of
86 workflows, tasks, and individual steps.
87  
88 =head2 METHODS
89  
90 L<SBOM::CycloneDX::Formulation> inherits all methods from L<SBOM::CycloneDX::Base>
91 and implements the following new ones.
92  
93 =over
94  
95 =item SBOM::CycloneDX::Formulation->new( %PARAMS )
96  
97 Properties:
98  
99 =over
100  
101 =item * C<bom_ref>, An identifier which can be used to reference the
102 formula elsewhere in the BOM. Every bom-ref must be unique within the BOM.
103 Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
104 conflicts with BOM-Links.
105  
106 =item * C<components>, Transient components that are used in tasks that
107 constitute one or more of this formula's workflows
108  
109 =item * C<properties>, Provides the ability to document properties in a
110 name-value store. This provides flexibility to include data not officially
111 supported in the standard without having to use additional namespaces or
112 create extensions. Unlike key-value stores, properties support duplicate
113 names, each potentially having different values. Property names of interest
114 to the general public are encouraged to be registered in the CycloneDX
115 Property Taxonomy (L<https://github.com/CycloneDX/cyclonedx-property-taxonomy>).
116 Formal registration is optional.
117  
118 =item * C<services>, Transient services that are used in tasks that
119 constitute one or more of this formula's workflows
120  
121 =item * C<workflows>, List of workflows that can be declared to accomplish
122 specific orchestrated goals and independently triggered.
123  
124 =back
125  
126 =item $formulation->bom_ref
127  
128 =item $formulation->components
129  
130 =item $formulation->properties
131  
132 =item $formulation->services
133  
134 =item $formulation->workflows
135  
136 =back
137  
138  
139 =head1 SUPPORT
140  
141 =head2 Bugs / Feature Requests
142  
143 Please report any bugs or feature requests through the issue tracker
144 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
145 You will be notified automatically of any progress on your issue.
146  
147 =head2 Source Code
148  
149 This is open source software. The code repository is available for
150 public review and contribution under the terms of the license.
151  
152 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
153  
154 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
155  
156  
157 =head1 AUTHOR
158  
159 =over 4
160  
161 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
162  
163 =back
164  
165  
166 =head1 LICENSE AND COPYRIGHT
167  
168 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
169  
170 This is free software; you can redistribute it and/or modify it under
171 the same terms as the Perl 5 programming language system itself.
172  
173 =cut
« CycloneDX/PatentAssertion.pm ↑ Summary CycloneDX/Declarations/Attestation.pm »