| 1 | package SBOM::CycloneDX::Citation; | ||||||||||
| 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 Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 1 | ▶ | use Types::Standard qw(Str InstanceOf HashRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 1 | ▶ | use Types::TypeTiny qw(ArrayLike); | ||||||||
|
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 | 0 | ▶ | has pointers => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | has expressions => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new }); | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||
| 28 | |||||||||||
| 29 | has timestamp => ( | ||||||||||
| 30 | is => 'rw', | ||||||||||
| 31 | isa => InstanceOf ['SBOM::CycloneDX::Timestamp'], | ||||||||||
| 32 | required => 1, | ||||||||||
| 33 | 0 | ▶ | coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::Timestamp->new($_[0]) } | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||
| 34 | 1 | ); | |||||||||
| 35 | |||||||||||
| 36 | 1 | has attributed_to => (is => 'rw', isa => Str); | |||||||||
| 37 | |||||||||||
| 38 | 1 | has process => (is => 'rw', isa => Str); | |||||||||
| 39 | |||||||||||
| 40 | 1 | has note => (is => 'rw', isa => Str); | |||||||||
| 41 | |||||||||||
| 42 | 1 | has signature => (is => 'rw', isa => HashRef); | |||||||||
| 43 | |||||||||||
| 44 | |||||||||||
| 45 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||
| 46 | |||||||||||
| 47 | 0 | my $self = shift; | |||||||||
| 48 | |||||||||||
| 49 | 0 | my $json = {timestamp => $self->timestamp}; | |||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 0 | ▶ | $json->{pointers} = $self->pointers if @{$self->pointers}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 0 | ▶ | $json->{expressions} = $self->expressions if @{$self->expressions}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | ▶ | $json->{timestamp} = $self->timestamp if $self->timestamp; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | ▶ | $json->{attributedTo} = $self->attributed_to if $self->attributed_to; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | ▶ | $json->{process} = $self->process if $self->process; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 57 | 0 | ▶ | $json->{note} = $self->note if $self->note; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 58 | 0 | ▶ | $json->{signature} = $self->signature if $self->signature; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | |||||||||||
| 60 | 0 | return $json; | |||||||||
| 61 | |||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 1 | 1; | |||||||||
| 65 | |||||||||||
| 66 | =encoding utf-8 | ||||||||||
| 67 | |||||||||||
| 68 | =head1 NAME | ||||||||||
| 69 | |||||||||||
| 70 | SBOM::CycloneDX::Citation - Citation | ||||||||||
| 71 | |||||||||||
| 72 | =head1 SYNOPSIS | ||||||||||
| 73 | |||||||||||
| 74 | SBOM::CycloneDX::Citation->new(); | ||||||||||
| 75 | |||||||||||
| 76 | |||||||||||
| 77 | =head1 DESCRIPTION | ||||||||||
| 78 | |||||||||||
| 79 | L<SBOM::CycloneDX::Citation> Details a specific attribution of data within | ||||||||||
| 80 | the BOM to a contributing entity or process. | ||||||||||
| 81 | |||||||||||
| 82 | =head2 METHODS | ||||||||||
| 83 | |||||||||||
| 84 | L<SBOM::CycloneDX::Citation> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 85 | and implements the following new ones. | ||||||||||
| 86 | |||||||||||
| 87 | =over | ||||||||||
| 88 | |||||||||||
| 89 | =item SBOM::CycloneDX::Citation->new( %PARAMS ) | ||||||||||
| 90 | |||||||||||
| 91 | Properties: | ||||||||||
| 92 | |||||||||||
| 93 | =over | ||||||||||
| 94 | |||||||||||
| 95 | =item * C<attributed_to>, The C<bom-ref> of an object, such as a component, | ||||||||||
| 96 | service, tool, organisational entity, or person that supplied the cited | ||||||||||
| 97 | information. | ||||||||||
| 98 | At least one of the "attributed_to" or "process" elements must be present. | ||||||||||
| 99 | |||||||||||
| 100 | =item * C<bom_ref>, BOM Reference | ||||||||||
| 101 | |||||||||||
| 102 | =item * C<expressions>, One or more path expressions used to locate values | ||||||||||
| 103 | within a BOM. | ||||||||||
| 104 | Exactly one of the "pointers" or "expressions" elements must be present. | ||||||||||
| 105 | |||||||||||
| 106 | =item * C<note>, A description or comment about the context or quality of the | ||||||||||
| 107 | data attribution. | ||||||||||
| 108 | |||||||||||
| 109 | =item * C<pointers>, One or more "JSON | ||||||||||
| 110 | Pointers" (L<https://datatracker.ietf.org/doc/html/rfc6901)> identifying the | ||||||||||
| 111 | BOM fields to which the attribution applies. | ||||||||||
| 112 | Exactly one of the "pointers" or "expressions" elements must be present. | ||||||||||
| 113 | |||||||||||
| 114 | =item * C<process>, The C<bom-ref> to a process (such as a formula, workflow, | ||||||||||
| 115 | task, or step) defined in the C<formulation> section that executed or | ||||||||||
| 116 | generated the attributed data. | ||||||||||
| 117 | At least one of the "attributed_to" or "process" elements must be present. | ||||||||||
| 118 | |||||||||||
| 119 | =item * C<signature>, A digital signature verifying the authenticity or | ||||||||||
| 120 | integrity of the attribution. | ||||||||||
| 121 | |||||||||||
| 122 | =item * C<timestamp>, The date and time when the attribution was made or the | ||||||||||
| 123 | information was supplied. | ||||||||||
| 124 | |||||||||||
| 125 | =back | ||||||||||
| 126 | |||||||||||
| 127 | =item $citation->attributed_to | ||||||||||
| 128 | |||||||||||
| 129 | =item $citation->bom_ref | ||||||||||
| 130 | |||||||||||
| 131 | =item $citation->expressions | ||||||||||
| 132 | |||||||||||
| 133 | =item $citation->note | ||||||||||
| 134 | |||||||||||
| 135 | =item $citation->pointers | ||||||||||
| 136 | |||||||||||
| 137 | =item $citation->process | ||||||||||
| 138 | |||||||||||
| 139 | =item $citation->signature | ||||||||||
| 140 | |||||||||||
| 141 | =item $citation->timestamp | ||||||||||
| 142 | |||||||||||
| 143 | =back | ||||||||||
| 144 | |||||||||||
| 145 | |||||||||||
| 146 | =head1 SUPPORT | ||||||||||
| 147 | |||||||||||
| 148 | =head2 Bugs / Feature Requests | ||||||||||
| 149 | |||||||||||
| 150 | Please report any bugs or feature requests through the issue tracker | ||||||||||
| 151 | at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 152 | You will be notified automatically of any progress on your issue. | ||||||||||
| 153 | |||||||||||
| 154 | =head2 Source Code | ||||||||||
| 155 | |||||||||||
| 156 | This is open source software. The code repository is available for | ||||||||||
| 157 | public review and contribution under the terms of the license. | ||||||||||
| 158 | |||||||||||
| 159 | L<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 160 | |||||||||||
| 161 | git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git | ||||||||||
| 162 | |||||||||||
| 163 | |||||||||||
| 164 | =head1 AUTHOR | ||||||||||
| 165 | |||||||||||
| 166 | =over 4 | ||||||||||
| 167 | |||||||||||
| 168 | =item * Giuseppe Di Terlizzi <gdt@cpan.org> | ||||||||||
| 169 | |||||||||||
| 170 | =back | ||||||||||
| 171 | |||||||||||
| 172 | |||||||||||
| 173 | =head1 LICENSE AND COPYRIGHT | ||||||||||
| 174 | |||||||||||
| 175 | This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi. | ||||||||||
| 176 | |||||||||||
| 177 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 178 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 179 | |||||||||||
| 180 | =cut | ||||||||||