File Coverage

blib/lib/SBOM/CycloneDX/BomRef.pm
Criterion Covered Total %
statement 25 25 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 2 2 100.0
total 37 37 100.0


line stmt bran cond sub pod time code
1             package SBOM::CycloneDX::BomRef;
2              
3 16     16   345 use 5.010001;
  16         62  
4 16     16   86 use strict;
  16         48  
  16         462  
5 16     16   179 use warnings;
  16         45  
  16         1011  
6 16     16   107 use utf8;
  16         31  
  16         93  
7              
8 16     16   608 use Carp;
  16         30  
  16         1088  
9 16     16   7581 use Time::Piece;
  16         164557  
  16         87  
10              
11 16     16   1732 use overload '""' => \&to_string, fallback => 1;
  16         33  
  16         120  
12              
13 16     16   8744 use Moo;
  16         101651  
  16         78  
14              
15             around BUILDARGS => sub {
16              
17             my ($orig, $class, @args) = @_;
18              
19             return {value => $args[0]} if @args == 1;
20             return $class->$orig(@args);
21              
22             };
23              
24             has value => (is => 'rw', required => 1);
25              
26 585     585 1 27513 sub to_string { shift->TO_JSON }
27              
28 971     971 1 11215 sub TO_JSON { shift->value }
29              
30             1;
31              
32             =encoding utf-8
33              
34             =head1 NAME
35              
36             SBOM::CycloneDX::BomRef - BOM-ref representation for CycloneDX
37              
38             =head1 SYNOPSIS
39              
40             $component->bom_ref(SBOM::CycloneDX::BomRef->new('app-component'));
41              
42              
43             =head1 DESCRIPTION
44              
45             L represents the BOM reference in L.
46              
47             =head2 METHODS
48              
49             =over
50              
51             =item SBOM::CycloneDX::BomRef->new( %PARAMS )
52              
53             =item $bom_ref->value
54              
55             =item $bom_ref->to_string
56              
57             =item $bom_ref->TO_JSON
58              
59             Return BOM ref.
60              
61             =back
62              
63             =head1 SUPPORT
64              
65             =head2 Bugs / Feature Requests
66              
67             Please report any bugs or feature requests through the issue tracker
68             at L.
69             You will be notified automatically of any progress on your issue.
70              
71             =head2 Source Code
72              
73             This is open source software. The code repository is available for
74             public review and contribution under the terms of the license.
75              
76             L
77              
78             git clone https://github.com/giterlizzi/perl-SBOM-CycloneDX.git
79              
80              
81             =head1 AUTHOR
82              
83             =over 4
84              
85             =item * Giuseppe Di Terlizzi
86              
87             =back
88              
89              
90             =head1 LICENSE AND COPYRIGHT
91              
92             This software is copyright (c) 2025-2026 by Giuseppe Di Terlizzi.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut