JCM/Boilerplate.pm

filter: Statementstmt 93.8% 76 / 81 Branchbran 66.6% 8 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 13 / 13 Podpod n/a totaltotal 91.5% 97 / 106 CC 8 SCAR 13.6
CC
8
Cov
90%
import
8.3
BEGIN
1.0
BEGIN
1.0
CRAP 3.9
↑ Summary JTM/Boilerplate.pm »
1 # Copyright (C) 2015-2025 Joelle Maslak
2 # All Rights Reserved - See License
3 #
4  
5 package JCM::Boilerplate;
6 # ABSTRACT: Default Boilerplate for Joelle Maslak's Code
7 2 $JCM::Boilerplate::VERSION = '2.253341';
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 2 ▶use v5.22;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 2 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 2 ▶no warnings 'experimental::re_strict';
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶use re 'strict';
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 2 ▶use English;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶use Import::Into;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 ▶use Smart::Comments;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 2 ▶use re;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 5 ▶sub import ( $self, $type = 'script' ) {
Subroutine import: called CC=8 SCAR=21.1
27 0 ▶ ### assert: ($type =~ m/^(?:class|role|script)$/ms)
Branch: 1 branch
BranchTrueFalseTotal
unless ($type =~ /^(?:class|role|script)$/msu) 0 5 5
28  
29 5 my $target = caller;
30  
31 5 strict->import::into($target);
32 5 warnings->import::into($target);
33 5 autodie->import::into($target);
34  
35 5 my ($ver) = "$PERL_VERSION" =~ m/^v(\d+\.\d+)\..*$/;
36 5 feature->import::into( $target, ":$ver" );
37  
38 5 utf8->import::into($target); # Allow UTF-8 Source
39  
40 5 ▶ if ( $type eq 'class' ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'class') { } 1 4 5
elsif ($type eq 'role') { } 1 3 4
41 1 Moose->import::into($target);
42 1 Moose::Util::TypeConstraints->import::into($target);
43 1 MooseX::StrictConstructor->import::into($target);
44 1 namespace::autoclean->import::into($target);
45 } elsif ( $type eq 'role' ) {
46 1 Moose::Role->import::into($target);
47 1 Moose::Util::TypeConstraints->import::into($target);
48 1 MooseX::StrictConstructor->import::into($target);
49 1 namespace::autoclean->import::into($target);
50 } else {
51 3 Feature::Compat::Class->import::into($target);
52 }
53  
54 5 Carp->import::into($target);
55 5 English->import::into($target);
56 5 Smart::Comments->import::into( $target, '-ENV', '###' );
57  
58 5 feature->import::into( $target, 'postderef' ); # Not needed if feature bundle >= 5.23.1
59  
60 5 Feature::Compat::Defer->import::into($target);
61 5 Feature::Compat::Try->import::into($target);
62  
63 # We haven't been using this
64 # feature->import::into($target, 'refaliasing');
65 5 feature->import::into( $target, 'signatures' );
66  
67 5 feature->import::into( $target, 'unicode_strings' );
68 # warnings->unimport::out_of($target, 'experimental::refaliasing');
69 5 warnings->unimport::out_of( $target, 'experimental::signatures' );
70  
71 5 ▶ if ( $PERL_VERSION lt v5.24.0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($JCM::Boilerplate::PERL_VERSION lt v5.24.0) 0 5 5
72 0 warnings->unimport::out_of( $target, 'experimental::postderef' );
73 }
74  
75 # For "re 'strict'" feature
76 5 warnings->unimport::out_of( $target, 'experimental::re_strict' );
77 5 re->import('strict');
78  
79 5 ▶ if ( $PERL_VERSION ge v5.32.0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($JCM::Boilerplate::PERL_VERSION ge v5.32.0) 5 0 5
80 # Turn off indirect syntax
81 5 feature->unimport::out_of( $target, 'indirect' );
82  
83 # Turn on isa
84 5 feature->import::into( $target, 'isa' );
85 5 warnings->unimport::out_of( $target, 'experimental::isa' );
86 }
87  
88 5 ▶ if ( $PERL_VERSION ge v5.34.0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($JCM::Boilerplate::PERL_VERSION ge v5.34.0) 5 0 5
89 # Turn off multidimensional "array" emulation
90 5 feature->unimport::out_of( $target, 'multidimensional' );
91  
92 # Turn off bareword filehandles
93 5 feature->unimport::out_of( $target, 'bareword_filehandles' );
94 }
95  
96 5 return;
97 }
98  
99 2 1;
100  
101 __END__
↑ Summary JTM/Boilerplate.pm »