File Coverage

blib/lib/Data/Hopen/Base.pm
Criterion Covered Total %
statement 36 36 100.0
branch 2 2 100.0
condition n/a
subroutine 11 11 100.0
pod n/a
total 49 49 100.0


line stmt bran cond sub pod time code
1             # Data::Hopen::Base: common definitions for hopen.
2             # Thanks to David Farrell,
3             # https://www.perl.com/article/how-to-build-a-base-module/
4             # Copyright (c) 2018 Christopher White. All rights reserved.
5             # LGPL 2.1+ - see the accompanying LICENSE file
6              
7             package Data::Hopen::Base;
8 25     25   2022512 use parent 'Exporter';
  25         600  
  25         223  
9 25     25   2031 use Import::Into;
  25         2790  
  25         1068  
10              
11             our $VERSION = '0.000018';
12              
13             # Pragmas
14 25     25   679 use 5.014;
  25         108  
15 25     25   165 use feature ":5.14";
  25         46  
  25         3222  
16 25     25   176 use strict;
  25         56  
  25         874  
17 25     25   152 use warnings;
  25         40  
  25         1096  
18             require experimental;
19              
20             # Packages
21 25     25   819 use Data::Dumper;
  25         6963  
  25         1387  
22 25     25   154 use Carp;
  25         47  
  25         1808  
23              
24             # Definitions from this file
25             use constant {
26 25         5007 true => !!1,
27             false => !!0,
28 25     25   188 };
  25         64  
29              
30             our @EXPORT = qw(true false);
31             #our @EXPORT_OK = qw();
32             #our %EXPORT_TAGS = (
33             # default => [@EXPORT],
34             # all => [@EXPORT, @EXPORT_OK]
35             #);
36              
37             #DEBUG
38             BEGIN {
39 25 100   25   348 unless($SIG{'__DIE__'}) {
40 24         3756 $SIG{'__DIE__'} = sub { Carp::confess(@_) };
  77         54998  
41             }
42             #$Exporter::Verbose=1;
43             }
44              
45             sub import {
46 258     258   314845 my $target = caller;
47              
48             # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
49 258         17373 Data::Hopen::Base->export_to_level(1, @_);
50              
51             # Re-export pragmas
52 258         2185 feature->import::into($target, qw(:5.14));
53 258         66600 "$_"->import::into($target) foreach qw(strict warnings);
54              
55             # Re-export packages
56 258         93144 Data::Dumper->import::into($target);
57 258         48985 Carp->import::into($target, qw(carp croak confess));
58              
59             # Permit smartmatch.
60             # http://blogs.perl.org/users/mike_b/2013/06/a-little-nicer-way-to-use-smartmatch-on-perl-518.html
61             # (Also, https://www.perlmonks.org/?node_id=1163370 is another approach.)
62 258         49426 experimental->import::into($target, 'smartmatch');
63              
64             } #import()
65              
66             1;
67             __END__