blib/lib/JCM/Boilerplate.pm untested

filter: Statementstmt 0.0% 0 / 76 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 100 CC 6 SCAR 27.3
CC
6
Cov
0%
import
42.0
BEGIN
2.0
BEGIN
2.0
CRAP 15.3
1 #
2 # Copyright (C) 2015-2021 Joelle Maslak
3 # All Rights Reserved - See License
4 #
5  
6 package JCM::Boilerplate;
7 # ABSTRACT: Default Boilerplate for Joelle Maslak's Code
8 $JCM::Boilerplate::VERSION = '2.211420';
9 use strict;
10 use warnings;
11  
12  
13 use v5.22;
14 use strict;
15  
16 use feature 'signatures';
17 no warnings 'experimental::signatures';
18  
19 no warnings 'experimental::re_strict';
20 use re 'strict';
21  
22 use English;
23 use Import::Into;
24 use Smart::Comments;
25 use re;
26  
27 sub import ( $self, $type = 'script' ) {
28 ### assert: ($type =~ m/^(?:class|role|script)$/ms)
29  
30 my $target = caller;
31  
32 strict->import::into($target);
33 warnings->import::into($target);
34 autodie->import::into($target);
35  
36 feature->import::into( $target, ':5.22' );
37  
38 utf8->import::into($target); # Allow UTF-8 Source
39  
40 if ( $type eq 'class' ) {
41 Moose->import::into($target);
42 Moose::Util::TypeConstraints->import::into($target);
43 MooseX::StrictConstructor->import::into($target);
44 namespace::autoclean->import::into($target);
45 } elsif ( $type eq 'role' ) {
46 Moose::Role->import::into($target);
47 Moose::Util::TypeConstraints->import::into($target);
48 MooseX::StrictConstructor->import::into($target);
49 namespace::autoclean->import::into($target);
50 }
51  
52 Carp->import::into($target);
53 English->import::into($target);
54 Smart::Comments->import::into( $target, '-ENV', '###' );
55  
56 feature->import::into( $target, 'postderef' ); # Not needed if feature bundle >= 5.23.1
57  
58 # We haven't been using this
59 # feature->import::into($target, 'refaliasing');
60 feature->import::into( $target, 'signatures' );
61  
62 feature->import::into( $target, 'switch' );
63 feature->import::into( $target, 'unicode_strings' );
64 # warnings->unimport::out_of($target, 'experimental::refaliasing');
65 warnings->unimport::out_of( $target, 'experimental::signatures' );
66  
67 if ( $PERL_VERSION lt v5.24.0 ) {
68 warnings->unimport::out_of( $target, 'experimental::postderef' );
69 }
70  
71 # For "switch" feature
72 warnings->unimport::out_of( $target, 'experimental::smartmatch' );
73  
74 # For "re 'strict'" feature
75 warnings->unimport::out_of( $target, 'experimental::re_strict' );
76 re->import( 'strict' );
77  
78 if ( $PERL_VERSION ge v5.32.0 ) {
79 # Turn off indirect syntax
80 feature->unimport::out_of( $target, 'indirect' );
81  
82 # Turn on isa
83 feature->import::into( $target, 'isa' );
84 warnings->unimport::out_of( $target, 'experimental::isa' );
85 }
86  
87 if ( $PERL_VERSION ge v5.34.0 ) {
88 # Turn off multidimensional "array" emulation
89 feature->unimport::out_of( $target, 'multidimensional' );
90  
91 # Turn off bareword filehandles
92 feature->unimport::out_of( $target, 'bareword_filehandles' );
93  
94 # Turn on Try/Catch
95 feature->import::into( $target, 'try' );
96 warnings->unimport::out_of( $target, 'experimental::try' );
97 }
98  
99 return;
100 }
101  
102 1;
103  
104 __END__
105  
106 =pod
107  
108 =encoding UTF-8
109  
110 =head1 NAME
111  
112 JCM::Boilerplate - Default Boilerplate for Joelle Maslak's Code
113  
114 =head1 VERSION
115  
116 version 2.211420
117  
118 =head1 SYNOPSIS
119  
120 use JCM::Boilerplate 'script';
121  
122 =head1 DESCRIPTION
123  
124 This module serves two purposes. First, it sets some default imports,
125 and turns on the strictures I've come to rely upon. Secondly, it depends
126 on a number of other modules to aid in setting up new environments (I can
127 just do a "cpan JCM-Boilerplate" to install everything I need).
128  
129 This module optionally takes one of two parameters, 'script', 'class',
130 or 'role'. If 'script' is specified, the module assumes that you do not
131 need Moose or MooseX modules.
132  
133 =head1 WARNINGS
134  
135 This module makes significant changes in the calling package!
136  
137 In addition, this module should be incorporated into any project by
138 copying it into the project's library tree. This protects the project from
139 outside dependencies that may be undesired.
140  
141 =head1 AUTHOR
142  
143 Joelle Maslak <jmaslak@antelope.net>
144  
145 =head1 COPYRIGHT AND LICENSE
146  
147 This software is copyright (c) 2015-2020 by Joelle Maslak.
148  
149 This is free software; you can redistribute it and/or modify it under
150 the same terms as the Perl 5 programming language system itself.
151  
152 =cut