CycloneDX/Annotation/Annotator.pm

filter: Statementstmt 72.5% 29 / 40 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 88.8% 8 / 9 Podpod 100% 1 / 1 totaltotal 63.3% 38 / 60 CC 6 SCAR 29.2
CC
6
Cov
58%
TO_JSON
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 18.6
« CycloneDX/CryptoProperties/Ikev2TransformType.pm ↑ Summary CycloneDX/Component/Commit.pm »
1 package SBOM::CycloneDX::Annotation::Annotator;
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 Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Types::Standard qw(InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 1 extends 'SBOM::CycloneDX::Base';
15  
16 1 has organization => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalEntity']);
17 1 has individual => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::OrganizationalContact']);
18 1 has component => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Component']);
19 1 has service => (is => 'rw', isa => InstanceOf ['SBOM::CycloneDX::Service']);
20  
21 0 ▶sub TO_JSON {
Subroutine TO_JSON: not called CC=6 SCAR=37.4
Pod documented
22  
23 0 my $self = shift;
24  
25 0 my $json = {};
26  
27 0 ▶ $json->{organization} = $self->organization if $self->organization;
Branch: 1 branch
BranchTrueFalseTotal
if $self->organization 0 0 0
28 0 ▶ $json->{individual} = $self->individual if $self->individual;
Branch: 1 branch
BranchTrueFalseTotal
if $self->individual 0 0 0
29 0 ▶ $json->{component} = $self->component if $self->component;
Branch: 1 branch
BranchTrueFalseTotal
if $self->component 0 0 0
30 0 ▶ $json->{service} = $self->service if $self->service;
Branch: 1 branch
BranchTrueFalseTotal
if $self->service 0 0 0
31  
32 0 my @check = keys %{$json};
33  
34 0 ▶ if (scalar @check != 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @check != 1) 0 0 0
35 0 Carp::croak '"organization", "individual", "component" and "service" cannot be used at the same time';
36 }
37  
38 0 return $json;
39  
40 }
41  
42 1 1;
43  
44 =encoding utf-8
45  
46 =head1 NAME
47  
48 SBOM::CycloneDX::Annotation::Annotator - Annotator
49  
50 =head1 SYNOPSIS
51  
52 SBOM::CycloneDX::Annotation::Annotator->new();
53  
54  
55 =head1 DESCRIPTION
56  
57 L<SBOM::CycloneDX::Annotation::Annotator> provides the organization, person,
58 component, or service which created the textual content of the annotation.
59  
60 =head2 METHODS
61  
62 L<SBOM::CycloneDX::Annotation::Annotator> inherits all methods from L<SBOM::CycloneDX::Base>
63 and implements the following new ones.
64  
65 =over
66  
67 =item SBOM::CycloneDX::Annotation::Annotator->new( %PARAMS )
68  
69 Properties:
70  
71 =over
72  
73 =item * C<component>, The tool or component that created the annotation
74  
75 =item * C<individual>, The person that created the annotation
76  
77 =item * C<organization>, The organization that created the annotation
78  
79 =item * C<service>, The service that created the annotation
80  
81 =back
82  
83 =item $annotator->component
84  
85 =item $annotator->individual
86  
87 =item $annotator->organization
88  
89 =item $annotator->service
90  
91 =back
92  
93  
94 =head1 SUPPORT
95  
96 =head2 Bugs / Feature Requests
97  
98 Please report any bugs or feature requests through the issue tracker
99 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
100 You will be notified automatically of any progress on your issue.
101  
102 =head2 Source Code
103  
104 This is open source software. The code repository is available for
105 public review and contribution under the terms of the license.
106  
107 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
108  
109 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
110  
111  
112 =head1 AUTHOR
113  
114 =over 4
115  
116 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
117  
118 =back
119  
120  
121 =head1 LICENSE AND COPYRIGHT
122  
123 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
124  
125 This is free software; you can redistribute it and/or modify it under
126 the same terms as the Perl 5 programming language system itself.
127  
128 =cut
« CycloneDX/CryptoProperties/Ikev2TransformType.pm ↑ Summary CycloneDX/Component/Commit.pm »