blib/lib/Devel/Cover/DB/IO.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 13 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 61 CC 6 SCAR 28.2
CC
6
Cov
0%
BEGIN
30.0
new
6.0
BEGIN
2.0
CRAP 16.8
1 # Copyright 2011-2026, Paul Johnson (paul@pjcj.net)
2  
3 # This software is free. It is licensed under the same terms as Perl itself.
4  
5 # The latest version of this software should be available from my homepage:
6 # https://pjcj.net
7  
8 package Devel::Cover::DB::IO;
9  
10 use strict;
11 use warnings;
12  
13 our $VERSION = '1.52'; # VERSION
14  
15 my $Format;
16  
17 BEGIN {
18 $Format = "Sereal" if eval "use Sereal::Decoder; use Sereal::Encoder; 1";
19 $Format = "JSON" if !$Format and eval { require JSON::MaybeXS; 1 };
20 $Format = "Storable" if !$Format and eval "use Storable; 1";
21 die "Can't load either JSON or Storable" unless $Format;
22 }
23  
24 sub new {
25 my $class = shift;
26  
27 my $format = $ENV{DEVEL_COVER_DB_FORMAT} || $Format;
28 ($format) = $format =~ /(.*)/; # die tainting
29 die "Devel::Cover: Unrecognised DB format: $format"
30 unless $format =~ /^(?:Storable|JSON|Sereal)$/;
31  
32 $class .= "::$format";
33 eval "use $class; 1" or die "Devel::Cover: $@";
34  
35 $class->new(options => $ENV{DEVEL_COVER_IO_OPTIONS} || "", @_)
36 }
37  
38 1
39  
40 __END__