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   1598 use 5.010001;
  16         79  
4 16     16   119 use strict;
  16         83  
  16         511  
5 16     16   97 use warnings;
  16         34  
  16         979  
6 16     16   131 use utf8;
  16         37  
  16         191  
7              
8 16     16   639 use SBOM::CycloneDX::BomRef;
  16         47  
  16         652  
9 16     16   101 use Types::Standard qw(Str InstanceOf);
  16         70  
  16         190  
10              
11 16     16   50829 use Moo;
  16         46  
  16         150  
12 16     16   6740 use namespace::autoclean;
  16         42  
  16         192  
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 981     981 1 6722 my $self = shift;
29              
30 981         1667 my $json = {};
31              
32 981 50       18395 $json->{'bom-ref'} = $self->bom_ref if $self->bom_ref;
33 981 100       22500 $json->{name} = $self->name if $self->name;
34 981 100       22923 $json->{email} = $self->email if $self->email;
35 981 100       22835 $json->{phone} = $self->phone if $self->phone;
36              
37 981         10290 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