CycloneDX/PostalAddress.pm

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