File Coverage

blib/lib/SBOM/CycloneDX/Metadata/Lifecycle.pm
Criterion Covered Total %
statement 32 32 100.0
branch 8 10 80.0
condition 4 6 66.6
subroutine 10 10 100.0
pod 1 2 50.0
total 55 60 91.6


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::Metadata::Lifecycle;
2              
3 2     2   3706 use 5.010001;
  2         10  
4 2     2   32 use strict;
  2         5  
  2         55  
5 2     2   7 use warnings;
  2         4  
  2         120  
6 2     2   13 use utf8;
  2         5  
  2         36  
7              
8 2     2   78 use SBOM::CycloneDX::Enum;
  2         3  
  2         179  
9              
10 2     2   11 use Types::Standard qw(Enum Str);
  2         4  
  2         23  
11              
12 2     2   4209 use Moo;
  2         4  
  2         15  
13 2     2   927 use namespace::autoclean;
  2         4  
  2         22  
14              
15             extends 'SBOM::CycloneDX::Base';
16              
17             sub BUILD {
18 9     9 0 4335 my ($self, $args) = @_;
19 9 50 66     83 Carp::croak('"phase" and "name" cannot be used at the same time') if exists $args->{phase} && exists $args->{name};
20 9 50 66     292 Carp::croak('"description" without "name"') if exists $args->{phase} && exists $args->{description};
21             }
22              
23             has phase => (is => 'rw', isa => Enum [SBOM::CycloneDX::Enum->values('LIFECYCLE_PHASE')]);
24             has name => (is => 'rw', isa => Str);
25             has description => (is => 'rw', isa => Str);
26              
27             sub TO_JSON {
28              
29 117     117 1 375 my $self = shift;
30              
31 117         196 my $json = {};
32              
33 117 100       2751 $json->{phase} = $self->phase if $self->phase;
34 117 100       4862 $json->{name} = $self->name if $self->name;
35 117 100       3675 $json->{description} = $self->description if $self->description;
36              
37 117         3005 return $json;
38              
39             }
40              
41             1;
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             SBOM::CycloneDX::Metadata::Lifecycle - Lifecycle
48              
49             =head1 SYNOPSIS
50              
51             SBOM::CycloneDX::Metadata::Lifecycle->new();
52              
53              
54             =head1 DESCRIPTION
55              
56             L provides the product lifecycle(s) that
57             this BOM represents.
58              
59             =head2 METHODS
60              
61             L inherits all methods from L
62             and implements the following new ones.
63              
64             =over
65              
66             =item SBOM::CycloneDX::Metadata::Lifecycle->new( %PARAMS )
67              
68             Properties:
69              
70             =over
71              
72             =item * C, The name of the lifecycle phase.
73              
74             =item * C, The description of the lifecycle phase.
75              
76             =item * C, A pre-defined phase in the product lifecycle.
77              
78             =back
79              
80             =item $lifecycle->description
81              
82             =item $lifecycle->name
83              
84             =item $lifecycle->phase
85              
86             =back
87              
88              
89             =head1 SUPPORT
90              
91             =head2 Bugs / Feature Requests
92              
93             Please report any bugs or feature requests through the issue tracker
94             at L.
95             You will be notified automatically of any progress on your issue.
96              
97             =head2 Source Code
98              
99             This is open source software. The code repository is available for
100             public review and contribution under the terms of the license.
101              
102             L
103              
104             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
105              
106              
107             =head1 AUTHOR
108              
109             =over 4
110              
111             =item * Giuseppe Di Terlizzi
112              
113             =back
114              
115              
116             =head1 LICENSE AND COPYRIGHT
117              
118             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
119              
120             This is free software; you can redistribute it and/or modify it under
121             the same terms as the Perl 5 programming language system itself.
122              
123             =cut