CycloneDX/ExternalReference.pm

filter: Statementstmt 78.2% 36 / 46 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 76.9% 10 / 13 Podpod 100% 1 / 1 totaltotal 71.2% 47 / 66 CC 4 SCAR 17.7
CC
4
Cov
69%
TO_JSON
20.0
__ANON__
2.0
__ANON__
2.0
CRAP 5.9
« CycloneDX/Declarations/Targets.pm ↑ Summary CycloneDX/PostalAddress.pm »
1 package SBOM::CycloneDX::ExternalReference;
2  
3 16 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use SBOM::CycloneDX::Enum;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 ▶use Types::Standard qw(Str Enum InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 16 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 16 extends 'SBOM::CycloneDX::Base';
18  
19 16 has url => (is => 'rw', isa => Str, required => 1);
20  
21 16 has comment => (is => 'rw', isa => Str);
22  
23 16 has type => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('EXTERNAL_REFERENCE_TYPE')], required => 1);
24  
25 has hashes => (
26 is => 'rw',
27 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Hash']],
28 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
29 16 );
30  
31 has properties => (
32 is => 'rw',
33 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Property']],
34 0 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: not called CC=1 SCAR=6.9
35 16 );
36  
37 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=4 SCAR=30.0
Pod documented
38  
39 0 my $self = shift;
40  
41 0 my $json = {url => $self->url, type => $self->type};
42  
43 0 ▶ $json->{comment} = $self->comment if $self->comment;
Branch: 1 branch
BranchTrueFalseTotal
if $self->comment 0 0 0
44 0 ▶ $json->{hashes} = $self->hashes if @{$self->hashes};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->hashes;} 0 0 0
45 0 ▶ $json->{properties} = $self->properties if @{$self->properties};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->properties;} 0 0 0
46  
47 0 return $json;
48  
49 }
50  
51 16 1;
52  
53 =encoding utf-8
54  
55 =head1 NAME
56  
57 SBOM::CycloneDX::ExternalReference - External Reference
58  
59 =head1 SYNOPSIS
60  
61 SBOM::CycloneDX::ExternalReference->new();
62  
63  
64 =head1 DESCRIPTION
65  
66 L<SBOM::CycloneDX::ExternalReference> provide a way to
67 document systems, sites, and information that may be relevant but are not
68 included with the BOM. They may also establish specific relationships
69 within or external to the BOM.
70  
71 =head2 METHODS
72  
73 L<SBOM::CycloneDX::ExternalReference> inherits all methods from L<SBOM::CycloneDX::Base>
74 and implements the following new ones.
75  
76 =over
77  
78 =item SBOM::CycloneDX::ExternalReference->new( %PARAMS )
79  
80 Properties:
81  
82 =over
83  
84 =item * C<comment>, A comment describing the external reference
85  
86 =item * C<hashes>, The hashes of the external reference (if applicable).
87  
88 =item * C<properties>, Provides the ability to document properties in a name-value
89 store. This provides flexibility to include data not officially supported in the
90 standard without having to use additional namespaces or create extensions.
91 Unlike key-value stores, properties support duplicate names, each potentially
92 having different values. Property names of interest to the general public are
93 encouraged to be registered in the CycloneDX Property Taxonomy. Formal
94 registration is optional. See L<SBOM::CycloneDX::Property>
95  
96 =item * C<type>, Specifies the type of external reference.
97  
98 =item * C<url>, The URI (URL or URN) to the external reference. External
99 references are URIs and therefore can accept any URL scheme including https
100 (RFC-7230 - L<https://www.ietf.org/rfc/rfc7230.txt>), mailto
101 (RFC-2368 - L<https://www.ietf.org/rfc/rfc2368.txt>), tel
102 (RFC-3966 - L<https://www.ietf.org/rfc/rfc3966.txt>), and dns
103 (RFC-4501 - L<https://www.ietf.org/rfc/rfc4501.txt>). External references may
104 also include formally registered URNs such as CycloneDX
105 BOM-Link (L<https://cyclonedx.org/capabilities/bomlink/>) to reference
106 CycloneDX BOMs or any object within a BOM. BOM-Link transforms applicable
107 external references into relationships that can be expressed in a BOM or
108 across BOMs.
109  
110 =back
111  
112 =item $external_reference->comment
113  
114 =item $external_reference->hashes
115  
116 =item $external_reference->properties
117  
118 =item $external_reference->type
119  
120 =item $external_reference->url
121  
122 =back
123  
124  
125 =head1 SUPPORT
126  
127 =head2 Bugs / Feature Requests
128  
129 Please report any bugs or feature requests through the issue tracker
130 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
131 You will be notified automatically of any progress on your issue.
132  
133 =head2 Source Code
134  
135 This is open source software. The code repository is available for
136 public review and contribution under the terms of the license.
137  
138 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
139  
140 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
141  
142  
143 =head1 AUTHOR
144  
145 =over 4
146  
147 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
148  
149 =back
150  
151  
152 =head1 LICENSE AND COPYRIGHT
153  
154 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
155  
156 This is free software; you can redistribute it and/or modify it under
157 the same terms as the Perl 5 programming language system itself.
158  
159 =cut
« CycloneDX/Declarations/Targets.pm ↑ Summary CycloneDX/PostalAddress.pm »