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   2075631 use parent 'Exporter';
  25         605  
  25         195  
9 25     25   2038 use Import::Into;
  25         2847  
  25         960  
10              
11             our $VERSION = '0.000019';
12              
13             # Pragmas
14 25     25   764 use 5.014;
  25         96  
15 25     25   179 use feature ":5.14";
  25         56  
  25         3061  
16 25     25   175 use strict;
  25         68  
  25         864  
17 25     25   150 use warnings;
  25         52  
  25         1072  
18             require experimental;
19              
20             # Packages
21 25     25   826 use Data::Dumper;
  25         7109  
  25         1300  
22 25     25   164 use Carp;
  25         73  
  25         1858  
23              
24             # Definitions from this file
25             use constant {
26 25         5367 true => !!1,
27             false => !!0,
28 25     25   172 };
  25         49  
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   353 unless($SIG{'__DIE__'}) {
40 24         3777 $SIG{'__DIE__'} = sub { Carp::confess(@_) };
  81         59655  
41             }
42             #$Exporter::Verbose=1;
43             }
44              
45             sub import {
46 259     259   299411 my $target = caller;
47              
48             # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
49 259         17233 Data::Hopen::Base->export_to_level(1, @_);
50              
51             # Re-export pragmas
52 259         2127 feature->import::into($target, qw(:5.14));
53 259         66902 "$_"->import::into($target) foreach qw(strict warnings);
54              
55             # Re-export packages
56 259         94085 Data::Dumper->import::into($target);
57 259         49603 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 259         50574 experimental->import::into($target, 'smartmatch');
63              
64             } #import()
65              
66             1;
67             __END__