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   2047393 use parent 'Exporter';
  25         586  
  25         202  
9 25     25   2058 use Import::Into;
  25         2709  
  25         968  
10              
11             our $VERSION = '0.000017';
12              
13             # Pragmas
14 25     25   771 use 5.014;
  25         92  
15 25     25   176 use feature ":5.14";
  25         67  
  25         3116  
16 25     25   175 use strict;
  25         44  
  25         866  
17 25     25   149 use warnings;
  25         65  
  25         1072  
18             require experimental;
19              
20             # Packages
21 25     25   796 use Data::Dumper;
  25         6934  
  25         1403  
22 25     25   164 use Carp;
  25         50  
  25         1928  
23              
24             # Definitions from this file
25             use constant {
26 25         5182 true => !!1,
27             false => !!0,
28 25     25   193 };
  25         67  
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   358 unless($SIG{'__DIE__'}) {
40 24         3883 $SIG{'__DIE__'} = sub { Carp::confess(@_) };
  77         57484  
41             }
42             #$Exporter::Verbose=1;
43             }
44              
45             sub import {
46 258     258   325913 my $target = caller;
47              
48             # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
49 258         17751 Data::Hopen::Base->export_to_level(1, @_);
50              
51             # Re-export pragmas
52 258         2134 feature->import::into($target, qw(:5.14));
53 258         68212 "$_"->import::into($target) foreach qw(strict warnings);
54              
55             # Re-export packages
56 258         93588 Data::Dumper->import::into($target);
57 258         49509 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         50879 experimental->import::into($target, 'smartmatch');
63              
64             } #import()
65              
66             1;
67             __END__