CycloneDX/OrganizationalEntity.pm

filter: Statementstmt 98.1% 53 / 54 Branchbran 41.6% 5 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 93.7% 15 / 16 Podpod 100% 1 / 1 totaltotal 89.1% 74 / 83 CC 7 SCAR 10.8
CC
7
Cov
88%
TO_JSON
6.5
__ANON__
6.0
BEGIN
1.0
CRAP 3.0
« CycloneDX/OrganizationalContact.pm ↑ Summary CycloneDX/Schema.pm »
1 package SBOM::CycloneDX::OrganizationalEntity;
2  
3 16 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 16 ▶use SBOM::CycloneDX::BomRef;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use SBOM::CycloneDX::PostalAddress;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 16 ▶use SBOM::CycloneDX::List;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 16 ▶use Types::Standard qw(Str InstanceOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 16 ▶use Types::TypeTiny qw(ArrayLike);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 16 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 16 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 16 extends 'SBOM::CycloneDX::Base';
19  
20 has bom_ref => (
21 is => 'rw',
22 isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
23 0 ▶ coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
24 16 );
25  
26 16 has name => (is => 'rw', isa => Str);
27  
28 has address => (
29 is => 'rw',
30 isa => InstanceOf ['SBOM::CycloneDX::PostalAddress'],
31 66 ▶ default => sub { SBOM::CycloneDX::PostalAddress->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
32 16 );
33  
34 66 ▶has url => (is => 'rw', isa => ArrayLike [Str], default => sub { SBOM::CycloneDX::List->new });
Subroutine __ANON__: called CC=1 SCAR=0.0
35  
36 has contact => (
37 is => 'rw',
38 isa => ArrayLike [InstanceOf ['SBOM::CycloneDX::OrganizationalContact']],
39 66 ▶ default => sub { SBOM::CycloneDX::List->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
40 16 );
41  
42 159 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=6 SCAR=18.7
Pod documented
43  
44 159 my $self = shift;
45  
46 159 my $json = {};
47  
48 159 ▶ $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
Branch: 1 branch
BranchTrueFalseTotal
if $self->bom_ref 0 159 159
49 159 ▶ $json->{name} = $self->name if $self->name;
Branch: 1 branch
BranchTrueFalseTotal
if $self->name 0 159 159
50 159 ▶ $json->{address} = $self->address if %{$self->address->TO_JSON};
Branch: 1 branch
BranchTrueFalseTotal
if %{$self->address->TO_JSON;} 0 159 159
51 159 ▶ $json->{url} = $self->url if @{$self->url};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->url;} 0 159 159
52 159 ▶ $json->{contact} = $self->contact if @{$self->contact};
Branch: 1 branch
BranchTrueFalseTotal
if @{$self->contact;} 0 159 159
53  
54 159 return $json;
55  
56 }
57  
58 16 1;
59  
60 =encoding utf-8
61  
62 =head1 NAME
63  
64 SBOM::CycloneDX::OrganizationalEntity - Organizational Entity
65  
66 =head1 SYNOPSIS
67  
68 SBOM::CycloneDX::OrganizationalEntity->new();
69  
70  
71 =head1 DESCRIPTION
72  
73 L<SBOM::CycloneDX::OrganizationalEntity> provides the organization entity object.
74  
75 =head2 METHODS
76  
77 L<SBOM::CycloneDX::OrganizationalEntity> inherits all methods from L<SBOM::CycloneDX::Base>
78 and implements the following new ones.
79  
80 =over
81  
82 =item SBOM::CycloneDX::OrganizationalEntity->new( %PARAMS )
83  
84 Properties:
85  
86 =over
87  
88 =item * C<address>, The physical address (location) of the organization
89  
90 =item * C<bom_ref>, An identifier which can be used to reference the object
91 elsewhere in the BOM. Every bom-ref must be unique within the BOM.
92 Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
93 conflicts with BOM-Links.
94  
95 =item * C<contact>, A contact at the organization. Multiple contacts are
96 allowed.
97  
98 =item * C<name>, The name of the organization
99  
100 =item * C<url>, The URL of the organization. Multiple URLs are allowed.
101  
102 =back
103  
104 =item $organizational_entity->address
105  
106 =item $organizational_entity->bom_ref
107  
108 =item $organizational_entity->contact
109  
110 =item $organizational_entity->name
111  
112 =item $organizational_entity->url
113  
114 =back
115  
116  
117 =head1 SUPPORT
118  
119 =head2 Bugs / Feature Requests
120  
121 Please report any bugs or feature requests through the issue tracker
122 at L<https://github.com/giterlizzi/perl-SBOM-CycloneDX/issues>.
123 You will be notified automatically of any progress on your issue.
124  
125 =head2 Source Code
126  
127 This is open source software. The code repository is available for
128 public review and contribution under the terms of the license.
129  
130 L<https://github.com/giterlizzi/perl-SBOM-CycloneDX>
131  
132 git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
133  
134  
135 =head1 AUTHOR
136  
137 =over 4
138  
139 =item * Giuseppe Di Terlizzi <gdt@cpan.org>
140  
141 =back
142  
143  
144 =head1 LICENSE AND COPYRIGHT
145  
146 This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
147  
148 This is free software; you can redistribute it and/or modify it under
149 the same terms as the Perl 5 programming language system itself.
150  
151 =cut
« CycloneDX/OrganizationalContact.pm ↑ Summary CycloneDX/Schema.pm »