CycloneDX/Source.pm

filter: Statementstmt 82.7% 24 / 29 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 100% 1 / 1 totaltotal 76.1% 32 / 42 CC 3 SCAR 14.6
CC
3
Cov
73%
TO_JSON
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.3
« CycloneDX/Component/Graphic.pm ↑ Summary CycloneDX/Declarations.pm »
1 package SBOM::CycloneDX::Source;
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 Types::Standard qw(Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 extends 'SBOM::CycloneDX::Base';
14  
15 1 has name => (is => 'rw', isa => Str);
16 1 has url => (is => 'rw', isa => Str);
17  
18 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=3 SCAR=24.8
Pod documented
19  
20 0 my $self = shift;
21  
22 0 my $json = {};
23  
24 0 ▶ $json->{url} = $self->url if $self->url;
Branch: 1 branch
BranchTrueFalseTotal
if $self->url 0 0 0
25 0 ▶ $json->{name} = $self->name if $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->name 0 0 0
26  
27 0 return $json;
28  
29 }
30  
31 1 1;
32  
33 =encoding utf-8
34  
35 =head1 NAME
36  
37 SBOM::CycloneDX::Source - Source of the issue/vulnerability where it is documented
38  
39 =head1 SYNOPSIS
40  
41 $issue->source(
42 SBOM::CycloneDX::Source->new(
43 name => 'NVD',
44 url => 'https://nvd.nist.gov/vuln/detail/CVE-2019-9997'
45 )
46 );
47  
48 $vulnerability = SBOM::CycloneDX::Vulnerability->new(
49 id => 'SNYK-JAVA-COMFASTERXMLJACKSONCORE-32111',
50 source => SBOM::CycloneDX::Vulnerability::Source->new(
51 name => 'Snyk',
52 url => 'https://snyk.io/vuln/SNYK-JAVA-COMFASTERXMLJACKSONCORE-32111'
53 )
54 );
55  
56  
57 =head1 DESCRIPTION
58  
59 L<SBOM::CycloneDX::Source> of the issue/vulnerability where it is documented.
60  
61 =head2 METHODS
62  
63 L<SBOM::CycloneDX::Source> inherits all methods from L<SBOM::CycloneDX::Base>
64 and implements the following new ones.
65  
66 =over
67  
68 =item SBOM::CycloneDX::Source->new( %PARAMS )
69  
70 Properties:
71  
72 =over
73  
74 =item * C<name>, The name of the source.
75  
76 =item * C<url>, The url of the issue/vulnerability documentation as provided by the source.
77  
78 =back
79  
80 =item $source->name
81  
82 =item $source->url
83  
84 =back
85  
86 =head1 SUPPORT
87  
88 =head2 Bugs / Feature Requests
89  
90 Please report any bugs or feature requests through the issue tracker
91 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
92 You will be notified automatically of any progress on your issue.
93  
94 =head2 Source Code
95  
96 This is open source software. The code repository is available for
97 public review and contribution under the terms of the license.
98  
99 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
100  
101 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
102  
103  
104 =head1 AUTHOR
105  
106 =over 4
107  
108 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
109  
110 =back
111  
112  
113 =head1 LICENSE AND COPYRIGHT
114  
115 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
116  
117 This is free software; you can redistribute it and/or modify it under
118 the same terms as the Perl 5 programming language system itself.
119  
120 =cut
« CycloneDX/Component/Graphic.pm ↑ Summary CycloneDX/Declarations.pm »