| 1 | package SBOM::CycloneDX::Annotation; | ||||||||||
| 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 | 1 | ▶ | use SBOM::CycloneDX::Timestamp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 1 | ▶ | use Types::Standard qw(Str HashRef InstanceOf); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 1 | ▶ | use Types::TypeTiny qw(ArrayLike); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 17 | |||||||||||
| 18 | 1 | extends 'SBOM::CycloneDX::Base'; | |||||||||
| 19 | |||||||||||
| 20 | has bom_ref => ( | ||||||||||
| 21 | is => 'rw', | ||||||||||
| 22 | isa => InstanceOf ['SBOM::CycloneDX::BomRef'], | ||||||||||
| 23 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 24 | 1 | ); | |||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | has subjects => (is => 'rw', isa => ArrayLike [Str], required => 1, default => sub { SBOM::CycloneDX::List->new }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 27 | |||||||||||
| 28 | has annotator => ( | ||||||||||
| 29 | is => 'rw', | ||||||||||
| 30 | isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Annotation::Annotator']], | ||||||||||
| 31 | required => 1, | ||||||||||
| 32 | 0 | ▶ | default => sub { SBOM::CycloneDX::List->new } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 33 | 1 | ); | |||||||||
| 34 | |||||||||||
| 35 | has timestamp => ( | ||||||||||
| 36 | is => 'rw', | ||||||||||
| 37 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 38 | required => 1, | ||||||||||
| 39 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 40 | 1 | ); | |||||||||
| 41 | |||||||||||
| 42 | 1 | has text => (is => 'rw', isa => Str, required => 1); | |||||||||
| 43 | 0 | ▶ | has signature => (is => 'rw', isa => ArrayLike [HashRef], default => sub { SBOM::CycloneDX::List->new }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 46 | |||||||||||
| 47 | 0 | my $self = shift; | |||||||||
| 48 | |||||||||||
| 49 | 0 | my $json = { | |||||||||
| 50 | subjects => $self->subjects, | ||||||||||
| 51 | annotator => $self->annotator, | ||||||||||
| 52 | timestamp => $self->timestamp, | ||||||||||
| 53 | text => $self->text | ||||||||||
| 54 | }; | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | ▶ | $json->{signature} = $self->signature if $self->signature; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | 0 | return $json; | |||||||||
| 61 | |||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 1 | 1; | |||||||||
| 65 | |||||||||||
| 66 | =encoding utf-8 | ||||||||||
| 67 | |||||||||||
| 68 | =head1 NAME | ||||||||||
| 69 | |||||||||||
| 70 | SBOM::CycloneDX::Annotation - Annotations | ||||||||||
| 71 | |||||||||||
| 72 | =head1 SYNOPSIS | ||||||||||
| 73 | |||||||||||
| 74 | SBOM::CycloneDX::Annotation->new(); | ||||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | =head1 DESCRIPTION | ||||||||||
| 78 | |||||||||||
| 79 | A comment, note, explanation, or similar textual content which provides | ||||||||||
| 80 | additional context to the object(s) being annotated. | ||||||||||
| 81 | |||||||||||
| 82 | =head2 METHODS | ||||||||||
| 83 | |||||||||||
| 84 | L<SBOM::CycloneDX::Annotation> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 85 | and implements the following new ones. | ||||||||||
| 86 | |||||||||||
| 87 | =over | ||||||||||
| 88 | |||||||||||
| 89 | =item SBOM::CycloneDX::Annotation->new( %PARAMS ) | ||||||||||
| 90 | |||||||||||
| 91 | Properties: | ||||||||||
| 92 | |||||||||||
| 93 | =over | ||||||||||
| 94 | |||||||||||
| 95 | =item * C<annotator>, The organization, person, component, or service which | ||||||||||
| 96 | created the textual content of the annotation. | ||||||||||
| 97 | |||||||||||
| 98 | =item * C<bom_ref>, An identifier which can be used to reference the | ||||||||||
| 99 | annotation elsewhere in the BOM. Every bom-ref must be unique within the | ||||||||||
| 100 | BOM. | ||||||||||
| 101 | Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid | ||||||||||
| 102 | conflicts with BOM-Links. | ||||||||||
| 103 | |||||||||||
| 104 | =item * C<signature>, Enveloped signature in JSON Signature Format (JSF) | ||||||||||
| 105 | (L<https://cyberphone.github.io/doc/security/jsf.html>). | ||||||||||
| 106 | |||||||||||
| 107 | =item * C<subjects>, The object in the BOM identified by its bom-ref. This is | ||||||||||
| 108 | often a component or service, but may be any object type supporting | ||||||||||
| 109 | bom-refs. | ||||||||||
| 110 | |||||||||||
| 111 | =item * C<text>, The textual content of the annotation. | ||||||||||
| 112 | |||||||||||
| 113 | =item * C<timestamp>, The date and time (timestamp) when the annotation was | ||||||||||
| 114 | created. | ||||||||||
| 115 | |||||||||||
| 116 | =back | ||||||||||
| 117 | |||||||||||
| 118 | =item $annotation->annotator | ||||||||||
| 119 | |||||||||||
| 120 | =item $annotation->bom_ref | ||||||||||
| 121 | |||||||||||
| 122 | =item $annotation->signature | ||||||||||
| 123 | |||||||||||
| 124 | =item $annotation->subjects | ||||||||||
| 125 | |||||||||||
| 126 | =item $annotation->text | ||||||||||
| 127 | |||||||||||
| 128 | =item $annotation->timestamp | ||||||||||
| 129 | |||||||||||
| 130 | =back | ||||||||||
| 131 | |||||||||||
| 132 | |||||||||||
| 133 | =head1 SUPPORT | ||||||||||
| 134 | |||||||||||
| 135 | =head2 Bugs / Feature Requests | ||||||||||
| 136 | |||||||||||
| 137 | Please report any bugs or feature requests through the issue tracker | ||||||||||
| 138 | at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 139 | You will be notified automatically of any progress on your issue. | ||||||||||
| 140 | |||||||||||
| 141 | =head2 Source Code | ||||||||||
| 142 | |||||||||||
| 143 | This is open source software. The code repository is available for | ||||||||||
| 144 | public review and contribution under the terms of the license. | ||||||||||
| 145 | |||||||||||
| 146 | L<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 147 | |||||||||||
| 148 | git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git | ||||||||||
| 149 | |||||||||||
| 150 | |||||||||||
| 151 | =head1 AUTHOR | ||||||||||
| 152 | |||||||||||
| 153 | =over 4 | ||||||||||
| 154 | |||||||||||
| 155 | =item * Giuseppe Di Terlizzi <gdt@cpan.org> | ||||||||||
| 156 | |||||||||||
| 157 | =back | ||||||||||
| 158 | |||||||||||
| 159 | |||||||||||
| 160 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 161 | |||||||||||
| 162 | This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi. | ||||||||||
| 163 | |||||||||||
| 164 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 165 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 166 | |||||||||||
| 167 | =cut | ||||||||||