File Coverage

blib/lib/Build/Hopen/Base.pm
Criterion Covered Total %
statement 35 35 100.0
branch 1 2 50.0
condition n/a
subroutine 11 11 100.0
pod n/a
total 47 48 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   1259612 use parent 'Exporter';
  16         479  
  16         129  
9 16     16   1498 use Import::Into;
  16         2661  
  16         543  
10              
11             our $VERSION = '0.000008'; # TRIAL
12              
13             # Pragmas
14 16     16   441 use 5.014;
  16         55  
15 16     16   136 use feature ":5.14";
  16         34  
  16         2035  
16 16     16   108 use strict;
  16         44  
  16         473  
17 16     16   85 use warnings;
  16         27  
  16         647  
18             require experimental;
19              
20             # Packages
21 16     16   707 use Data::Dumper;
  16         6780  
  16         832  
22 16     16   96 use Carp;
  16         38  
  16         1330  
23              
24             # Definitions from this file
25             use constant {
26 16         2830 true => !!1,
27             false => !!0,
28 16     16   111 };
  16         28  
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   2646 $SIG{'__DIE__'} = sub { Carp::confess(@_) } unless $SIG{'__DIE__'};
  2         5460  
40             #$Exporter::Verbose=1;
41             }
42              
43             sub import {
44 133     133   31834 my $target = caller;
45              
46             # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
47 133         8739 Build::Hopen::Base->export_to_level(1, @_);
48              
49             # Re-export pragmas
50 133         1054 feature->import::into($target, qw(:5.14));
51 133         33572 "$_"->import::into($target) foreach qw(strict warnings);
52              
53             # Re-export packages
54 133         47608 Data::Dumper->import::into($target);
55 133         24887 Carp->import::into($target, qw(carp croak confess));
56              
57             # Permit smartmatch.
58             # http://blogs.perl.org/users/mike_b/2013/06/a-little-nicer-way-to-use-smartmatch-on-perl-518.html
59             # (Also, https://www.perlmonks.org/?node_id=1163370 is another approach.)
60 133         25724 experimental->import::into($target, 'smartmatch');
61              
62             } #import()
63              
64             1;
65             __END__