CycloneDX/Declarations/Signatory.pm

filter: Statementstmt 69.7% 30 / 43 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 12 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 80.0% 8 / 10 Podpod 50.0% 1 / 2 totaltotal 44.8% 39 / 87 CC 12 SCAR 34.4
CC
12
Cov
43%
BUILD
56.0
TO_JSON
42.0
BEGIN
1.0
CRAP 31.0
« CycloneDX/Citation.pm ↑ Summary CycloneDX/Attachment.pm »
1 package SBOM::CycloneDX::Declarations::Signatory;
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::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Types::Standard qw(InstanceOf HashRef Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 extends 'SBOM::CycloneDX::Base';
16  
17 0 ▶sub BUILD {
Subroutine BUILD: not called CC=7 SCAR=40.3
Pod undocumented
18 0 my ($self, $args) = @_;
19  
20 0 ▶ if (exists $args->{signature} and exists $args->{organization} and exists $args->{external_reference}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"signature"} and exists $args->{"organization"} and exists $args->{"external_reference"}) 0 0 0
Condition0%0/6
exists $args->{"signature"} and exists $args->{"organization"} and exists $args->{"external_reference"}
!ll&&!rl&&r
000
exists $args->{"signature"} and exists $args->{"organization"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $args->{"signature"} and exists $args->{"organization"} and exists $args->{"external_reference"}
exists $args->{"signature"} exists $args->{"organization"} exists $args->{"external_reference"}
Truth table0%0/4
A and B and C
A= exists $args->{"signature"}B= exists $args->{"organization"}C= exists $args->{"external_reference"}
ABCresult
0XX0
10X0
1100
1111
21 0 Carp::croak('"signature", "organization" and "external_reference" cannot be used at the same time');
22 }
23  
24 0 ▶ if (!exists $args->{signature} and (not exists $args->{organization} or not exists $args->{external_reference})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $args->{"signature"} || exists $args->{"organization"} && exists $args->{"external_reference"}) 0 0 0
Condition0%0/6
exists $args->{'signature'} || exists $args->{'organization'} && exists $args->{'external_reference'}
l!l&&r!l&&!r
000
exists $args->{"organization"} and exists $args->{"external_reference"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $args->{'signature'} || exists $args->{'organization'} && exists $args->{'external_reference'}
exists $args->{'signature'} exists $args->{"organization"} exists $args->{"external_reference"}
Truth table0%0/4
A || B and C
A= exists $args->{'signature'}B= exists $args->{"organization"}C= exists $args->{"external_reference"}
ABCresult
1XX1
0111
00X0
0100
25 0 Carp::croak('"organization" and "external_reference" are required');
26 }
27  
28 }
29  
30 1 has name => (is => 'rw', isa => Str);
31 1 has role => (is => 'rw', isa => Str);
32 1 has signature => (is => 'rw', isa => HashRef);
33 1 has organization => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalEntity']);
34 1 has external_reference => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::ExternalReference']);
35  
36  
37 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=6 SCAR=37.4
Pod documented
38  
39 0 my $self = shift;
40  
41 0 my $json = {};
42  
43 0 ▶ $json->{name} = $self->name if $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->name 0 0 0
44 0 ▶ $json->{role} = $self->role if $self->role;
Branch: 1 branch
BranchTrueFalseTotal
if $self->role 0 0 0
45 0 ▶ $json->{signature} = $self->signature if $self->signature;
Branch: 1 branch
BranchTrueFalseTotal
if $self->signature 0 0 0
46 0 ▶ $json->{organization} = $self->organization if $self->organization;
Branch: 1 branch
BranchTrueFalseTotal
if $self->organization 0 0 0
47 0 ▶ $json->{externalReference} = $self->external_reference if $self->external_reference;
Branch: 1 branch
BranchTrueFalseTotal
if $self->external_reference 0 0 0
48  
49 0 return $json;
50  
51 }
52  
53 1 1;
54  
55 =encoding utf-8
56  
57 =head1 NAME
58  
59 SBOM::CycloneDX::Declarations::Signatory - Signatory
60  
61 =head1 SYNOPSIS
62  
63 SBOM::CycloneDX::Declarations::Signatory->new();
64  
65  
66 =head1 DESCRIPTION
67  
68 L<SBOM::CycloneDX::Declarations::Signatory> provide the signatory authorized on
69 behalf of an organization to assert validity of this document.
70  
71 =head2 METHODS
72  
73 L<SBOM::CycloneDX::Declarations::Signatory> inherits all methods from L<SBOM::CycloneDX::Base>
74 and implements the following new ones.
75  
76 =over
77  
78 =item SBOM::CycloneDX::Declarations::Signatory->new( %PARAMS )
79  
80 Properties:
81  
82 =over
83  
84 =item * C<external_reference>, External references provide a way to document
85 systems, sites, and information that may be relevant but are not included
86 with the BOM. They may also establish specific relationships within or
87 external to the BOM.
88  
89 =item * C<name>, The signatory's name.
90  
91 =item * C<organization>, The signatory's organization.
92  
93 =item * C<role>, The signatory's role within an organization.
94  
95 =item * C<signature>, Enveloped signature in JSON Signature Format (JSF)
96 (L<https://cyberphone.github.io/doc/security/jsf.html>).
97  
98 =back
99  
100 =item $signatory->external_reference
101  
102 =item $signatory->name
103  
104 =item $signatory->organization
105  
106 =item $signatory->role
107  
108 =item $signatory->signature
109  
110 =back
111  
112  
113 =head1 SUPPORT
114  
115 =head2 Bugs / Feature Requests
116  
117 Please report any bugs or feature requests through the issue tracker
118 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
119 You will be notified automatically of any progress on your issue.
120  
121 =head2 Source Code
122  
123 This is open source software. The code repository is available for
124 public review and contribution under the terms of the license.
125  
126 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
127  
128 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
129  
130  
131 =head1 AUTHOR
132  
133 =over 4
134  
135 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
136  
137 =back
138  
139  
140 =head1 LICENSE AND COPYRIGHT
141  
142 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
143  
144 This is free software; you can redistribute it and/or modify it under
145 the same terms as the Perl 5 programming language system itself.
146  
147 =cut
« CycloneDX/Citation.pm ↑ Summary CycloneDX/Attachment.pm »