CycloneDX/Component/SWID.pm

filter: Statementstmt 100% 37 / 37 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 91.0% 51 / 56 CC 6 SCAR 13.0
CC
6
Cov
89%
TO_JSON
6.8
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« CycloneDX/Vulnerability/Credits.pm ↑ Summary CycloneDX/Component/QuantitativeAnalysis.pm »
1 package SBOM::CycloneDX::Component::SWID;
2  
3 2 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Types::Standard qw(Str InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 2 extends 'SBOM::CycloneDX::Base';
14  
15 2 has tag_id => (is => 'rw', isa => Str, required => 1);
16 2 has name => (is => 'rw', isa => Str, required => 1);
17 2 has version => (is => 'rw', isa => Str);
18 2 has tag_version => (is => 'rw', isa => Str);
19 2 has patch => (is => 'rw', isa => Str);
20 2 has text => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Attachment']);
21 2 has url => (is => 'rw', isa => Str);
22  
23 36 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=6 SCAR=19.1
Pod documented
24  
25 36 my $self = shift;
26  
27 36 my $json = {tagId => $self->tag_id, name => $self->name};
28  
29 36 ▶ $json->{version} = $self->version if $self->version;
Branch: 1 branch
BranchTrueFalseTotal
if $self->version 36 0 36
30 36 ▶ $json->{tagVersion} = $self->tag_version if $self->tag_version;
Branch: 1 branch
BranchTrueFalseTotal
if $self->tag_version 0 36 36
31 36 ▶ $json->{patch} = $self->patch if $self->patch;
Branch: 1 branch
BranchTrueFalseTotal
if $self->patch 0 36 36
32 36 ▶ $json->{text} = $self->text if $self->text;
Branch: 1 branch
BranchTrueFalseTotal
if $self->text 0 36 36
33 36 ▶ $json->{url} = $self->url if $self->url;
Branch: 1 branch
BranchTrueFalseTotal
if $self->url 0 36 36
34  
35 36 return $json;
36  
37 }
38  
39 2 1;
40  
41 =encoding utf-8
42  
43 =head1 NAME
44  
45 SBOM::CycloneDX::Component::SWID - SWID Tag
46  
47 =head1 SYNOPSIS
48  
49 SBOM::CycloneDX::Component::SWID->new();
50  
51  
52 =head1 DESCRIPTION
53  
54 L<SBOM::CycloneDX::Component::SWID> specifies metadata and content for
55 ISO-IEC 19770-2 Software Identification (SWID) Tags.
56  
57 =head2 METHODS
58  
59 L<SBOM::CycloneDX::Component::SWID> inherits all methods from L<SBOM::CycloneDX::Base>
60 and implements the following new ones.
61  
62 =over
63  
64 =item SBOM::CycloneDX::Component::SWID->new( %PARAMS )
65  
66 Properties:
67  
68 =over
69  
70 =item * C<name>, Maps to the name of a SoftwareIdentity.
71  
72 =item * C<patch>, Maps to the patch of a SoftwareIdentity.
73  
74 =item * C<tag_id>, Maps to the tagId of a SoftwareIdentity.
75  
76 =item * C<tag_version>, Maps to the tagVersion of a SoftwareIdentity.
77  
78 =item * C<text>, Specifies the metadata and content of the SWID tag.
79  
80 =item * C<url>, The URL to the SWID file.
81  
82 =item * C<version>, Maps to the version of a SoftwareIdentity.
83  
84 =back
85  
86 =item $swid->name
87  
88 =item $swid->patch
89  
90 =item $swid->tag_id
91  
92 =item $swid->tag_version
93  
94 =item $swid->text
95  
96 =item $swid->url
97  
98 =item $swid->version
99  
100 =back
101  
102  
103  
104 =head1 SUPPORT
105  
106 =head2 Bugs / Feature Requests
107  
108 Please report any bugs or feature requests through the issue tracker
109 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
110 You will be notified automatically of any progress on your issue.
111  
112 =head2 Source Code
113  
114 This is open source software. The code repository is available for
115 public review and contribution under the terms of the license.
116  
117 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
118  
119 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
120  
121  
122 =head1 AUTHOR
123  
124 =over 4
125  
126 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
127  
128 =back
129  
130  
131 =head1 LICENSE AND COPYRIGHT
132  
133 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
134  
135 This is free software; you can redistribute it and/or modify it under
136 the same terms as the Perl 5 programming language system itself.
137  
138 =cut
« CycloneDX/Vulnerability/Credits.pm ↑ Summary CycloneDX/Component/QuantitativeAnalysis.pm »