| 1 | package SBOM::CycloneDX::Standard; | ||||||||||
| 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 | 1 | ▶ | use SBOM::CycloneDX::List; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | use Types::Standard qw(Str InstanceOf HashRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use Types::TypeTiny qw(ArrayLike); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 1 | extends 'SBOM::CycloneDX::Base'; | |||||||||
| 18 | |||||||||||
| 19 | has bom_ref => ( | ||||||||||
| 20 | is => 'rw', | ||||||||||
| 21 | isa => InstanceOf ['SBOM::CycloneDX::BomRef'], | ||||||||||
| 22 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 23 | 1 | ); | |||||||||
| 24 | |||||||||||
| 25 | 1 | has name => (is => 'rw', isa => Str); | |||||||||
| 26 | 1 | has version => (is => 'rw', isa => Str); | |||||||||
| 27 | 1 | has description => (is => 'rw', isa => Str); | |||||||||
| 28 | 1 | has owner => (is => 'rw', isa => Str); | |||||||||
| 29 | |||||||||||
| 30 | has requirements => ( | ||||||||||
| 31 | is => 'rw', | ||||||||||
| 32 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Standard::Requirement']], | ||||||||||
| 33 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 34 | 1 | ); | |||||||||
| 35 | |||||||||||
| 36 | has levels => ( | ||||||||||
| 37 | is => 'rw', | ||||||||||
| 38 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Standard::Level']], | ||||||||||
| 39 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 40 | 1 | ); | |||||||||
| 41 | |||||||||||
| 42 | has external_references => ( | ||||||||||
| 43 | is => 'rw', | ||||||||||
| 44 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::ExternalReference']], | ||||||||||
| 45 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 46 | 1 | ); | |||||||||
| 47 | |||||||||||
| 48 | 1 | has signature => (is => 'rw', isa => HashRef); | |||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||
| 51 | |||||||||||
| 52 | 0 | my $self = shift; | |||||||||
| 53 | |||||||||||
| 54 | 0 | my $json = {}; | |||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | $json->{'bom-ref'} = $self->bom if $self->bom_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | ▶ | $json->{name} = $self->name if $self->name; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | ▶ | $json->{version} = $self->version if $self->version; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | 0 | ▶ | $json->{description} = $self->description if $self->description; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 60 | 0 | ▶ | $json->{owner} = $self->owner if $self->owner; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | ▶ | $json->{requirements} = $self->requirements if @{$self->requirements}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 62 | 0 | ▶ | $json->{levels} = $self->levels if @{$self->levels}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 63 | 0 | ▶ | $json->{externalReferences} = $self->external_references if @{$self->external_references}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 0 | ▶ | $json->{signature} = $self->signature if $self->signature; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 65 | |||||||||||
| 66 | 0 | return $json; | |||||||||
| 67 | |||||||||||
| 68 | } | ||||||||||
| 69 | |||||||||||
| 70 | 1 | 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<SBOM::CycloneDX::Standard> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 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<bom_ref>, 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<description>, The description of the standard. | ||||||||||
| 106 | |||||||||||
| 107 | =item * C<external_references>, 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<levels>, The list of levels associated with the standard. Some | ||||||||||
| 113 | standards have different levels of compliance. | ||||||||||
| 114 | |||||||||||
| 115 | =item * C<name>, The name of the standard. This will often be a shortened, | ||||||||||
| 116 | single name of the standard. | ||||||||||
| 117 | |||||||||||
| 118 | =item * C<owner>, The owner of the standard, often the entity responsible for | ||||||||||
| 119 | its release. | ||||||||||
| 120 | |||||||||||
| 121 | =item * C<requirements>, The list of requirements comprising the standard. | ||||||||||
| 122 | |||||||||||
| 123 | =item * C<signature>, Enveloped signature in [JSON Signature Format | ||||||||||
| 124 | (JSF)](https://cyberphone.github.io/doc/security/jsf.html). | ||||||||||
| 125 | |||||||||||
| 126 | =item * C<version>, 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 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 <gdt@cpan.org> | ||||||||||
| 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 | ||||||||||