Hopen/Base.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod n/a totaltotal 94.3% 50 / 53 CC 3 SCAR 3.1
CC
3
Cov
95%
BEGIN
2.5
import
2.0
__ANON__
1.1
CRAP 1.4
« Hopen/Toolchain.pm ↑ Summary Hopen/G/Goal.pm »
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 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 16 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 16 our $VERSION = '0.000008'; # TRIAL
12  
13 # Pragmas
14 16 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 16 ▶use feature ":5.14";
Subroutine BEGIN: called CC=1 SCAR=0.0
16 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 16 require experimental;
19  
20 # Packages
21 16 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 16 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 # Definitions from this file
25 16 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
26 16 true => !!1,
27 false => !!0,
28 16 };
29  
30 16 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 16 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=9.2
39 0 ▶ $SIG{'__DIE__'} = sub { Carp::confess(@_) } unless $SIG{'__DIE__'};
Subroutine __ANON__: not called CC=1 SCAR=1.2
Branch: 1 branch
BranchTrueFalseTotal
unless $SIG{"__DIE__"} 16 0 16
40 #$Exporter::Verbose=1;
41 }
42  
43 133 ▶sub import {
Subroutine import: called CC=2 SCAR=6.9
44 133 my $target = caller;
45  
46 # Copy symbols listed in @EXPORT first, in case @_ gets trashed later.
47 133 Build::Hopen::Base->export_to_level(1, @_);
48  
49 # Re-export pragmas
50 133 feature->import::into($target, qw(:5.14));
51 133 "$_"->import::into($target) foreach qw(strict warnings);
52  
53 # Re-export packages
54 133 Data::Dumper->import::into($target);
55 133 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 experimental->import::into($target, 'smartmatch');
61  
62 } #import()
63  
64 16 1;
65 __END__
« Hopen/Toolchain.pm ↑ Summary Hopen/G/Goal.pm »