File Coverage

blib/lib/SBOM/CycloneDX/Declarations/Signatory.pm
Criterion Covered Total %
statement 23 36 63.8
branch 0 14 0.0
condition 0 9 0.0
subroutine 8 10 80.0
pod 1 2 50.0
total 32 71 45.0


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Declarations::Signatory;
2              
3 1     1   1445 use 5.010001;
  1         4  
4 1     1   14 use strict;
  1         1  
  1         27  
5 1     1   5 use warnings;
  1         1  
  1         49  
6 1     1   4 use utf8;
  1         2  
  1         9  
7              
8 1     1   28 use SBOM::CycloneDX::List;
  1         2  
  1         31  
9              
10 1     1   3 use Types::Standard qw(InstanceOf HashRef Str);
  1         3  
  1         10  
11              
12 1     1   2564 use Moo;
  1         3  
  1         9  
13 1     1   351 use namespace::autoclean;
  1         1  
  1         13  
14              
15             extends 'SBOM::CycloneDX::Base';
16              
17             sub BUILD {
18 0     0 0   my ($self, $args) = @_;
19              
20 0 0 0       if (exists $args->{signature} and exists $args->{organization} and exists $args->{external_reference}) {
      0        
21 0           Carp::croak('"signature", "organization" and "external_reference" cannot be used at the same time');
22             }
23              
24 0 0 0       if (!exists $args->{signature} and (not exists $args->{organization} or not exists $args->{external_reference})) {
25 0           Carp::croak('"organization" and "external_reference" are required');
26             }
27              
28             }
29              
30             has name => (is => 'rw', isa => Str);
31             has role => (is => 'rw', isa => Str);
32             has signature => (is => 'rw', isa => HashRef);
33             has organization => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalEntity']);
34             has external_reference => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::ExternalReference']);
35              
36              
37             sub TO_JSON {
38              
39 0     0 1   my $self = shift;
40              
41 0           my $json = {};
42              
43 0 0         $json->{name} = $self->name if $self->name;
44 0 0         $json->{role} = $self->role if $self->role;
45 0 0         $json->{signature} = $self->signature if $self->signature;
46 0 0         $json->{organization} = $self->organization if $self->organization;
47 0 0         $json->{externalReference} = $self->external_reference if $self->external_reference;
48              
49 0           return $json;
50              
51             }
52              
53             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 provide the signatory authorized on
69             behalf of an organization to assert validity of this document.
70              
71             =head2 METHODS
72              
73             L inherits all methods from L
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 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, The signatory's name.
90              
91             =item * C, The signatory's organization.
92              
93             =item * C, The signatory's role within an organization.
94              
95             =item * C, Enveloped signature in JSON Signature Format (JSF)
96             (L).
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.
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
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
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