| 1 | package SBOM::CycloneDX::Property; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use 5.010001; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use Types::Standard qw(Str); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 1 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 1 | extends 'SBOM::CycloneDX::Base'; | |||||||||
| 14 | |||||||||||
| 15 | 1 | has name => (is => 'rw', isa => Str, required => 1); | |||||||||
| 16 | 1 | has value => (is => 'rw', isa => Str); | |||||||||
| 17 | |||||||||||
| 18 | 0 | ▶ | sub TO_JSON { | ||||||||
|
Subroutine
TO_JSON: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 19 | |||||||||||
| 20 | 0 | my $self = shift; | |||||||||
| 21 | |||||||||||
| 22 | 0 | my $json = {name => $self->name}; | |||||||||
| 23 | |||||||||||
| 24 | 0 | ▶ | $json->{value} = $self->value if $self->value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | |||||||||||
| 26 | 0 | return $json; | |||||||||
| 27 | |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 1 | 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<SBOM::CycloneDX::Manufacture> 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<https://github.com/CycloneDX/cyclonedx-property-taxonomy>). | ||||||||||
| 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<SBOM::CycloneDX::Property> inherits all methods from L<SBOM::CycloneDX::Base> | ||||||||||
| 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<name>, The name of the property. Duplicate names are allowed, each | ||||||||||
| 73 | potentially having a different value. | ||||||||||
| 74 | |||||||||||
| 75 | =item * C<value>, 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>. | ||||||||||
| 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<https://github.com/giterlizzi/perl-SBOM-CycloneDX> | ||||||||||
| 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 <gdt@cpan.org> | ||||||||||
| 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 | ||||||||||