File Coverage

blib/lib/SBOM/CycloneDX/Tools.pm
Criterion Covered Total %
statement 26 33 78.7
branch 0 4 0.0
condition n/a
subroutine 9 10 90.0
pod 1 1 100.0
total 36 48 75.0


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Tools;
2              
3 1     1   3340 use 5.010001;
  1         6  
4 1     1   7 use strict;
  1         2  
  1         31  
5 1     1   5 use warnings;
  1         3  
  1         69  
6 1     1   8 use utf8;
  1         2  
  1         8  
7              
8 1     1   39 use SBOM::CycloneDX::List;
  1         3  
  1         61  
9              
10 1     1   8 use Types::Standard qw(InstanceOf);
  1         3  
  1         10  
11 1     1   3663 use Types::TypeTiny qw(ArrayLike);
  1         3  
  1         10  
12              
13 1     1   633 use Moo;
  1         2  
  1         10  
14 1     1   522 use namespace::autoclean;
  1         3  
  1         15  
15              
16             extends 'SBOM::CycloneDX::Base';
17              
18             has components => (
19             is => 'rw',
20             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Component']],
21             default => sub { SBOM::CycloneDX::List->new }
22             );
23              
24             has services => (
25             is => 'rw',
26             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Service']],
27             default => sub { SBOM::CycloneDX::List->new }
28             );
29              
30             sub TO_JSON {
31              
32 0     0 1   my $self = shift;
33              
34 0           my $json = {};
35              
36 0 0         $json->{components} = $self->components if @{$self->components};
  0            
37 0 0         $json->{services} = $self->services if @{$self->services};
  0            
38              
39 0           return $json;
40              
41             }
42              
43             1;
44              
45             =encoding utf-8
46              
47             =head1 NAME
48              
49             SBOM::CycloneDX::Tools - The tool(s) used in the creation, enrichment, and
50             validation of the BOM.
51              
52             =head1 SYNOPSIS
53              
54             $tools = SBOM::CycloneDX::Tools->new;
55              
56             $tools->components->add($component);
57              
58             =head1 DESCRIPTION
59              
60             L used in the creation, enrichment, and validation of the BOM.
61              
62             =head2 METHODS
63              
64             L inherits all methods from L
65             and implements the following new ones.
66              
67             =over
68              
69             =item SBOM::CycloneDX::Tools->new( %PARAMS )
70              
71             Create a new L object.
72              
73             Parameters:
74              
75             =over
76              
77             =item * C, An ARRAY of software and hardware components used as tools.
78             See L.
79              
80             =item * C, An ARRAY of services used as tools. This may include microservices,
81             function-as-a-service, and other types of network or intra-process services.
82             See L.
83              
84             =back
85              
86             =item $tools->components
87              
88             An ARRAY of software and hardware components used as tools.
89             See L
90              
91             =item $tools->services
92              
93             An ARRAY of services used as tools. This may include microservices,
94             function-as-a-service, and other types of network or intra-process services.
95             See L.
96              
97             =item $tools->TO_JSON
98              
99             =back
100              
101              
102             =head1 SUPPORT
103              
104             =head2 Bugs / Feature Requests
105              
106             Please report any bugs or feature requests through the issue tracker
107             at L.
108             You will be notified automatically of any progress on your issue.
109              
110             =head2 Source Code
111              
112             This is open source software. The code repository is available for
113             public review and contribution under the terms of the license.
114              
115             L
116              
117             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
118              
119              
120             =head1 AUTHOR
121              
122             =over 4
123              
124             =item * Giuseppe Di Terlizzi
125              
126             =back
127              
128              
129             =head1 LICENSE AND COPYRIGHT
130              
131             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
132              
133             This is free software; you can redistribute it and/or modify it under
134             the same terms as the Perl 5 programming language system itself.
135              
136             =cut