File Coverage

blib/lib/SBOM/CycloneDX/Property.pm
Criterion Covered Total %
statement 20 24 83.3
branch 0 2 0.0
condition n/a
subroutine 7 8 87.5
pod 1 1 100.0
total 28 35 80.0


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Property;
2              
3 1     1   19 use 5.010001;
  1         3  
4 1     1   3 use strict;
  1         3  
  1         19  
5 1     1   3 use warnings;
  1         2  
  1         42  
6 1     1   5 use utf8;
  1         2  
  1         7  
7              
8 1     1   74 use Types::Standard qw(Str);
  1         2  
  1         11  
9              
10 1     1   1466 use Moo;
  1         3  
  1         10  
11 1     1   601 use namespace::autoclean;
  1         3  
  1         18  
12              
13             extends 'SBOM::CycloneDX::Base';
14              
15             has name => (is => 'rw', isa => Str, required => 1);
16             has value => (is => 'rw', isa => Str);
17              
18             sub TO_JSON {
19              
20 0     0 1   my $self = shift;
21              
22 0           my $json = {name => $self->name};
23              
24 0 0         $json->{value} = $self->value if $self->value;
25              
26 0           return $json;
27              
28             }
29              
30             1;
31              
32             =encoding utf-8
33              
34             =head1 NAME
35              
36             SBOM::CycloneDX::Property - Provides the ability to document properties in a
37             name-value store
38              
39             =head1 SYNOPSIS
40              
41             $bom->properties->add(
42             SBOM::CycloneDX::Property->new( name => 'Foo', value => 'Bar' )
43             );
44              
45              
46             =head1 DESCRIPTION
47              
48             L provides the ability to document properties in a
49             name-value store. This provides flexibility to include data not officially
50             supported in the standard without having to use additional namespaces or create
51             extensions. Unlike key-value stores, properties support duplicate names, each
52             potentially having different values. Property names of interest to the general
53             public are encouraged to be registered in the CycloneDX Property Taxonomy
54             (L).
55              
56             Formal registration is optional. Each item of this array must be a Lightweight
57             name-value pair object.
58              
59             =head2 METHODS
60              
61             L inherits all methods from L
62             and implements the following new ones.
63              
64             =over
65              
66             =item SBOM::CycloneDX::Property->new( %PARAMS )
67              
68             Properties:
69              
70             =over
71              
72             =item * C, The name of the property. Duplicate names are allowed, each
73             potentially having a different value.
74              
75             =item * C, The value of the property.
76              
77             =back
78              
79             =item $property->name
80              
81             =item $property->value
82              
83             =back
84              
85             =head1 SUPPORT
86              
87             =head2 Bugs / Feature Requests
88              
89             Please report any bugs or feature requests through the issue tracker
90             at L.
91             You will be notified automatically of any progress on your issue.
92              
93             =head2 Source Code
94              
95             This is open source software. The code repository is available for
96             public review and contribution under the terms of the license.
97              
98             L
99              
100             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
101              
102              
103             =head1 AUTHOR
104              
105             =over 4
106              
107             =item * Giuseppe Di Terlizzi
108              
109             =back
110              
111              
112             =head1 LICENSE AND COPYRIGHT
113              
114             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
115              
116             This is free software; you can redistribute it and/or modify it under
117             the same terms as the Perl 5 programming language system itself.
118              
119             =cut