File Coverage

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


line stmt bran cond sub pod time code
1             # Build::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 Build::Hopen::Base;
8 16     16   1007825 use parent 'Exporter';
  16         434  
  16         101  
9 16     16   1190 use Import::Into;
  16         2153  
  16         455  
10              
11             our $VERSION = '0.000006'; # TRIAL
12              
13             # Pragmas
14 16     16   289 use 5.014;
  16         44  
15 16     16   94 use feature ":5.14";
  16         49  
  16         1654  
16 16     16   101 use strict;
  16         28  
  16         342  
17 16     16   65 use warnings;
  16         21  
  16         536  
18             require experimental;
19              
20             # Packages
21 16     16   564 use Data::Dumper;
  16         5572  
  16         649  
22 16     16   101 use Carp;
  16         26  
  16         1017  
23              
24             # Definitions from this file
25             use constant {
26 16         2288 true => !!1,
27             false => !!0,
28 16     16   85 };
  16         26  
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 16 50   16   2285 $SIG{'__DIE__'} = sub { Carp::confess(@_) } unless $SIG{'__DIE__'};
  3         4590  
40             #$Exporter::Verbose=1;
41             }
42              
43             sub import {
44 134     134   25961 my $target = caller;
45              
46             # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
47 134         7641 Build::Hopen::Base->export_to_level(1, @_);
48              
49             # Re-export pragmas
50 134         881 feature->import::into($target, qw(:5.14));
51 134         27175 foreach my $pragma (qw(strict warnings)) {
52 268         20556 ${pragma}->import::into($target);
53             };
54              
55             # Re-export packages
56 134         19123 Data::Dumper->import::into($target);
57 134         20796 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 134         21165 experimental->import::into($target, 'smartmatch');
63              
64             } #import()
65              
66             1;
67             __END__