File Coverage

blib/lib/SBOM/CycloneDX/Declarations/Targets.pm
Criterion Covered Total %
statement 26 35 74.2
branch 0 6 0.0
condition n/a
subroutine 9 10 90.0
pod 1 1 100.0
total 36 52 69.2


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