File Coverage

blib/lib/SBOM/CycloneDX/OrganizationalContact.pm
Criterion Covered Total %
statement 30 30 100.0
branch 7 8 87.5
condition n/a
subroutine 9 9 100.0
pod 1 1 100.0
total 47 48 97.9


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::OrganizationalContact;
2              
3 16     16   334 use 5.010001;
  16         52  
4 16     16   69 use strict;
  16         60  
  16         409  
5 16     16   97 use warnings;
  16         27  
  16         685  
6 16     16   72 use utf8;
  16         33  
  16         126  
7              
8 16     16   469 use SBOM::CycloneDX::BomRef;
  16         29  
  16         444  
9 16     16   62 use Types::Standard qw(Str InstanceOf);
  16         27  
  16         159  
10              
11 16     16   38298 use Moo;
  16         34  
  16         99  
12 16     16   4890 use namespace::autoclean;
  16         33  
  16         144  
13              
14             extends 'SBOM::CycloneDX::Base';
15              
16             has bom_ref => (
17             is => 'rw',
18             isa => InstanceOf ['SBOM::CycloneDX::BomRef'],
19             coerce => sub { ref($_[0]) ? $_[0] : SBOM::CycloneDX::BomRef->new($_[0]) }
20             );
21              
22             has name => (is => 'rw', isa => Str);
23             has email => (is => 'rw', isa => Str);
24             has phone => (is => 'rw', isa => Str);
25              
26             sub TO_JSON {
27              
28 177     177 1 698 my $self = shift;
29              
30 177         197 my $json = {};
31              
32 177 50       1894 $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
33 177 100       2434 $json->{name} = $self->name if $self->name;
34 177 100       2464 $json->{email} = $self->email if $self->email;
35 177 100       2487 $json->{phone} = $self->phone if $self->phone;
36              
37 177         1339 return $json;
38              
39             }
40              
41             1;
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             SBOM::CycloneDX::OrganizationalContact - Organizational Contact
48              
49             =head1 SYNOPSIS
50              
51             SBOM::CycloneDX::OrganizationalContact->new();
52              
53              
54             =head1 DESCRIPTION
55              
56             L provides the organizational contact object.
57              
58             =head2 METHODS
59              
60             L inherits all methods from L
61             and implements the following new ones.
62              
63             =over
64              
65             =item SBOM::CycloneDX::OrganizationalContact->new( %PARAMS )
66              
67             Properties:
68              
69             =over
70              
71             =item * C, An identifier which can be used to reference the object
72             elsewhere in the BOM. Every bom-ref must be unique within the BOM.
73             Value SHOULD not start with the BOM-Link intro 'urn:cdx:' to avoid
74             conflicts with BOM-Links.
75              
76             =item * C, The email address of the contact.
77              
78             =item * C, The name of a contact
79              
80             =item * C, The phone number of the contact.
81              
82             =back
83              
84             =item $organizational_contact->bom_ref
85              
86             =item $organizational_contact->email
87              
88             =item $organizational_contact->name
89              
90             =item $organizational_contact->phone
91              
92             =back
93              
94              
95             =head1 SUPPORT
96              
97             =head2 Bugs / Feature Requests
98              
99             Please report any bugs or feature requests through the issue tracker
100             at L.
101             You will be notified automatically of any progress on your issue.
102              
103             =head2 Source Code
104              
105             This is open source software. The code repository is available for
106             public review and contribution under the terms of the license.
107              
108             L
109              
110             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
111              
112              
113             =head1 AUTHOR
114              
115             =over 4
116              
117             =item * Giuseppe Di Terlizzi
118              
119             =back
120              
121              
122             =head1 LICENSE AND COPYRIGHT
123              
124             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
125              
126             This is free software; you can redistribute it and/or modify it under
127             the same terms as the Perl 5 programming language system itself.
128              
129             =cut