File Coverage

blib/lib/SBOM/CycloneDX/License/ExpressionDetail.pm
Criterion Covered Total %
statement 23 29 79.3
branch 0 6 0.0
condition n/a
subroutine 8 9 88.8
pod 1 1 100.0
total 32 45 71.1


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::License::ExpressionDetail;
2              
3 1     1   1907 use 5.010001;
  1         3  
4 1     1   6 use strict;
  1         2  
  1         19  
5 1     1   3 use warnings;
  1         2  
  1         62  
6 1     1   4 use utf8;
  1         3  
  1         7  
7              
8 1     1   22 use SBOM::CycloneDX::BomRef;
  1         2  
  1         29  
9              
10 1     1   3 use Moo;
  1         2  
  1         6  
11 1     1   371 use namespace::autoclean;
  1         1  
  1         13  
12              
13 1     1   116 use Types::Standard qw(Str Enum InstanceOf);
  1         2  
  1         11  
14              
15             extends 'SBOM::CycloneDX::Base';
16              
17             has license_identifier => (is => 'rw', required => 1, isa => Str);
18              
19             has bom_ref => (
20             is => 'rw',
21             isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
22             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
23             );
24              
25             has text => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Attachment']);
26              
27             has url => (is => 'rw', isa => Str);
28              
29             sub TO_JSON {
30              
31 0     0 1   my $self = shift;
32              
33 0           my $json = {licenseIdentifier => $self->license_identifier};
34              
35 0 0         $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
36 0 0         $json->{text} = $self->text if $self->text;
37 0 0         $json->{url} = $self->url if $self->url;
38              
39 0           return $json;
40              
41             }
42              
43             1;
44              
45             =encoding utf-8
46              
47             =head1 NAME
48              
49             SBOM::CycloneDX::License::ExpressionDetail - Expression Details
50              
51             =head1 SYNOPSIS
52              
53             SBOM::CycloneDX::License::ExpressionDetail->new();
54              
55              
56             =head1 DESCRIPTION
57              
58             L Details for parts of the
59             `expression`.
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::License::ExpressionDetail->new( %PARAMS )
69              
70             Properties:
71              
72             =over
73              
74             =item * C, An identifier which can be used to reference the license
75             elsewhere in the BOM. Every C must be unique within the BOM.
76             Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
77             conflicts with BOM-Links.
78              
79             =item * C, The valid SPDX license identifier. Refer to
80             L for syntax requirements.
81             This property serves as the primary key, which uniquely identifies each
82             record.
83              
84             =item * C, A way to include the textual content of the license.
85              
86             =item * C, The URL to the license file. If specified, a 'license'
87             externalReference should also be specified for completeness
88              
89             =back
90              
91             =item $expression_detail->bom_ref
92              
93             =item $expression_detail->license_identifier
94              
95             =item $expression_detail->text
96              
97             =item $expression_detail->url
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