File Coverage

blib/lib/SBOM/CycloneDX/Source.pm
Criterion Covered Total %
statement 20 25 80.0
branch 0 4 0.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 28 38 73.6


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Source;
2              
3 1     1   1336 use 5.010001;
  1         3  
4 1     1   5 use strict;
  1         2  
  1         21  
5 1     1   2 use warnings;
  1         2  
  1         68  
6 1     1   5 use utf8;
  1         1  
  1         8  
7              
8 1     1   39 use Types::Standard qw(Str);
  1         2  
  1         7  
9              
10 1     1   2374 use Moo;
  1         2  
  1         9  
11 1     1   300 use namespace::autoclean;
  1         2  
  1         10  
12              
13             extends 'SBOM::CycloneDX::Base';
14              
15             has name => (is => 'rw', isa => Str);
16             has url => (is => 'rw', isa => Str);
17              
18             sub TO_JSON {
19              
20 0     0 1   my $self = shift;
21              
22 0           my $json = {};
23              
24 0 0         $json->{url} = $self->url if $self->url;
25 0 0         $json->{name} = $self->name if $self->name;
26              
27 0           return $json;
28              
29             }
30              
31             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 of the issue/vulnerability where it is documented.
60              
61             =head2 METHODS
62              
63             L inherits all methods from L
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, The name of the source.
75              
76             =item * C, 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.
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
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
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