CSAF/Base.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 42 CC 1 SCAR 6.9
CC
1
Cov
0%
clone
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package CSAF::Base;
2  
3 use 5.010001;
4 use strict;
5 use warnings;
6 use utf8;
7  
8 use Carp;
9 use Moo;
10  
11 around BUILDARGS => sub {
12  
13 my ($orig, $class, @args) = @_;
14  
15 return {csaf => $args[0]} if @args == 1;
16 return $class->$orig(@args);
17  
18 };
19  
20 has csaf => (
21 is => 'ro',
22 isa => sub {
23 Carp::croak 'Must be an instance of "CSAF"' unless ref($_[0]) eq 'CSAF';
24 },
25 required => 1
26 );
27  
28 sub clone {
29  
30 my $self = shift;
31 my $clone = {%$self};
32  
33 bless $clone, ref $self;
34 return $clone;
35  
36 }
37  
38 1;
39  
40 __END__