| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package SBOM::CycloneDX::Base; |
|
2
|
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
10141
|
use 5.010001; |
|
|
16
|
|
|
|
|
72
|
|
|
4
|
16
|
|
|
16
|
|
104
|
use strict; |
|
|
16
|
|
|
|
|
992
|
|
|
|
16
|
|
|
|
|
824
|
|
|
5
|
16
|
|
|
16
|
|
717
|
use warnings; |
|
|
16
|
|
|
|
|
307
|
|
|
|
16
|
|
|
|
|
1112
|
|
|
6
|
16
|
|
|
16
|
|
354
|
use utf8; |
|
|
16
|
|
|
|
|
36
|
|
|
|
16
|
|
|
|
|
212
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
16
|
|
|
16
|
|
2954
|
use Cpanel::JSON::XS; |
|
|
16
|
|
|
|
|
10477
|
|
|
|
16
|
|
|
|
|
1715
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
16
|
|
|
16
|
|
145
|
use overload '""' => \&to_string, fallback => 1; |
|
|
16
|
|
|
|
|
34
|
|
|
|
16
|
|
|
|
|
221
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
1
|
0
|
sub TO_JSON { Carp::croak 'TO_JSON is not extended by subclass' } |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub to_string { |
|
15
|
|
|
|
|
|
|
|
|
16
|
889
|
|
|
889
|
1
|
150555
|
my $self = shift; |
|
17
|
|
|
|
|
|
|
|
|
18
|
889
|
|
|
|
|
12727
|
my $json = Cpanel::JSON::XS->new->utf8->canonical->allow_nonref->allow_unknown->allow_blessed->convert_blessed |
|
19
|
|
|
|
|
|
|
->stringify_infnan->escape_slash(0)->allow_dupkeys->pretty->space_before(0); |
|
20
|
|
|
|
|
|
|
|
|
21
|
889
|
|
|
|
|
3888
|
return $json->encode($self->TO_JSON); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub to_hash { |
|
26
|
|
|
|
|
|
|
|
|
27
|
34
|
|
|
34
|
1
|
311764
|
my $self = shift; |
|
28
|
|
|
|
|
|
|
|
|
29
|
34
|
|
|
|
|
184
|
my $json = $self->to_string; |
|
30
|
34
|
|
|
|
|
1001
|
my $hash = Cpanel::JSON::XS->new->decode($json); |
|
31
|
|
|
|
|
|
|
|
|
32
|
34
|
|
|
|
|
315
|
return $hash; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=encoding utf-8 |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 NAME |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
SBOM::CycloneDX::Base - Base class for SBOM::CycloneDX |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$component->to_string; # Convert object in JSON |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$license->to_hash; # Convert object in HASH |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$bom->TO_JSON; Helper for JSON packages |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
L represents the BOM reference in L. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head2 METHODS |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item SBOM::CycloneDX::Base->new( %PARAMS ) |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item $base->to_string |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Stringify BOM object in JSON. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item $base->to_hash |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Convert BOM object in HASH. |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item $base->TO_JSON |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Helper method for JSON modules (L, L, L, L, etc). |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
use Mojo::JSON qw(encode_json); |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
say encode_json($bom); |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 SUPPORT |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head2 Bugs / Feature Requests |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Please report any bugs or feature requests through the issue tracker |
|
86
|
|
|
|
|
|
|
at L. |
|
87
|
|
|
|
|
|
|
You will be notified automatically of any progress on your issue. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 Source Code |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This is open source software. The code repository is available for |
|
92
|
|
|
|
|
|
|
public review and contribution under the terms of the license. |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
L |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * Giuseppe Di Terlizzi |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=back |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi. |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
113
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |