Hopen/Base.pm

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