File Coverage

blib/lib/SBOM/CycloneDX/Definitions.pm
Criterion Covered Total %
statement 33 33 100.0
branch 2 4 50.0
condition n/a
subroutine 10 10 100.0
pod 1 1 100.0
total 46 48 95.8


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Definitions;
2              
3 16     16   397 use 5.010001;
  16         71  
4 16     16   99 use strict;
  16         34  
  16         609  
5 16     16   127 use warnings;
  16         191  
  16         1159  
6 16     16   107 use utf8;
  16         58  
  16         195  
7              
8 16     16   9923 use SBOM::CycloneDX::List;
  16         67  
  16         766  
9              
10 16     16   163 use Types::Standard qw(InstanceOf);
  16         33  
  16         176  
11 16     16   50236 use Types::TypeTiny qw(ArrayLike);
  16         41  
  16         132  
12              
13 16     16   8916 use Moo;
  16         42  
  16         163  
14 16     16   7281 use namespace::autoclean;
  16         40  
  16         244  
15              
16             extends 'SBOM::CycloneDX::Base';
17              
18             has standards => (
19             is => 'rw',
20             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Standard']],
21             default => sub { SBOM::CycloneDX::List->new }
22             );
23              
24             has patents => (
25             is => 'rw',
26             isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::Patent'] | InstanceOf ['SBOM::CycloneDX::PatentFamily']],
27             default => sub { SBOM::CycloneDX::List->new }
28             );
29              
30             sub TO_JSON {
31              
32 356     356 1 3396 my $self = shift;
33              
34 356         760 my $json = {};
35              
36 356 50       607 $json->{standards} = $self->standards if @{$self->standards};
  356         7543  
37 356 50       697 $json->{patents} = $self->patents if @{$self->patents};
  356         7758  
38              
39 356         1357 return $json;
40              
41             }
42              
43             1;
44              
45             =encoding utf-8
46              
47             =head1 NAME
48              
49             SBOM::CycloneDX::Definitions - Definitions
50              
51             =head1 SYNOPSIS
52              
53             SBOM::CycloneDX::Definitions->new();
54              
55              
56             =head1 DESCRIPTION
57              
58             L is a collection of reusable objects that are
59             defined and may be used elsewhere in the BOM.
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::Definitions->new( %PARAMS )
69              
70             Properties:
71              
72             =over
73              
74             =item * C, The list of standards which may consist of regulations,
75             industry or organizational-specific standards, maturity models, best
76             practices, or any other requirements which can be evaluated against or
77             attested to.
78              
79             =item * C, The list of patents which may be referenced elsewhere
80              
81             =back
82              
83             =item $definitions->standards
84              
85             =item $definitions->patents
86              
87             =back
88              
89              
90             =head1 SUPPORT
91              
92             =head2 Bugs / Feature Requests
93              
94             Please report any bugs or feature requests through the issue tracker
95             at L.
96             You will be notified automatically of any progress on your issue.
97              
98             =head2 Source Code
99              
100             This is open source software. The code repository is available for
101             public review and contribution under the terms of the license.
102              
103             L
104              
105             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
106              
107              
108             =head1 AUTHOR
109              
110             =over 4
111              
112             =item * Giuseppe Di Terlizzi
113              
114             =back
115              
116              
117             =head1 LICENSE AND COPYRIGHT
118              
119             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
120              
121             This is free software; you can redistribute it and/or modify it under
122             the same terms as the Perl 5 programming language system itself.
123              
124             =cut