File Coverage

blib/lib/JCM/Boilerplate.pm
Criterion Covered Total %
statement 52 56 92.8
branch 10 14 71.4
condition n/a
subroutine 8 8 100.0
pod n/a
total 70 78 89.7


line stmt bran cond sub pod time code
1             #
2             # Copyright (C) 2015,2016 Joel C. Maslak
3             # All Rights Reserved - See License
4             #
5              
6             package JCM::Boilerplate v0.01.11;
7             # ABSTRACT: Default Boilerplate for Joel's Code
8             $JCM::Boilerplate::VERSION = '1.012';
9              
10 1     1   13548 use v5.22;
  1         2  
11 1     1   3 use strict;
  1         1  
  1         17  
12              
13 1     1   3 use feature 'signatures';
  1         3  
  1         91  
14 1     1   3 no warnings 'experimental::signatures';
  1         1  
  1         27  
15              
16 1     1   434 use English;
  1         2602  
  1         3  
17 1     1   785 use Import::Into;
  1         1886  
  1         22  
18 1     1   490 use Smart::Comments;
  1         26151  
  1         5  
19              
20 4 50   4   5927 sub import($self, $type='script') {
  4 50       11  
  4 100       7  
  4         10  
  4         4  
21 4 50       24 ### assert: ($type =~ m/^(?:class|role|script)$/ms)
  0         0  
  0         0  
  0         0  
  0         0  
22                 
23 4         8     my $target = caller;
24              
25 4         23     strict->import::into($target);
26 4         694     warnings->import::into($target);
27 4         504     autodie->import::into($target);
28              
29 4         23876     feature->import::into($target, ':5.22');
30              
31 4         847     utf8->import::into($target); # Allow UTF-8 Source
32              
33 4 100       1113     if ($type eq 'class') {
    100          
34 1         4         Moose->import::into($target);
35 1         307102         Moose::Util::TypeConstraints->import::into($target);
36 1         1394         MooseX::StrictConstructor->import::into($target);
37 1         21639         namespace::autoclean->import::into($target);
38                 } elsif ($type eq 'role') {
39 1         8         Moose::Role->import::into($target);
40 1         3822         Moose::Util::TypeConstraints->import::into($target);
41 1         1292         MooseX::StrictConstructor->import::into($target);
42 1         415         namespace::autoclean->import::into($target);
43                 }
44              
45 4         425     Carp->import::into($target);
46 4         698     English->import::into($target);
47 4         1670     Smart::Comments->import::into($target, '-ENV', '###');
48              
49 4         741     feature->import::into($target, 'postderef'); # Not needed if feature budle >= 5.23.1
50              
51             # We haven't been using this
52             # feature->import::into($target, 'refaliasing');
53 4         566     feature->import::into($target, 'signatures');
54              
55 4         520     feature->import::into($target, 'switch');
56 4         506     feature->import::into($target, 'unicode_strings');
57             # warnings->unimport::out_of($target, 'experimental::refaliasing');
58 4         547     warnings->unimport::out_of($target, 'experimental::signatures');
59              
60 4 50       739     if ($PERL_VERSION lt v5.24.0) {
61 4         13         warnings->unimport::out_of($target, 'experimental::postderef');
62                 }
63              
64             # For "switch" feature
65 4         535     warnings->unimport::out_of($target, 'experimental::smartmatch');
66             }
67              
68             1;
69              
70             __END__
71            
72             =pod
73            
74             =encoding UTF-8
75            
76             =head1 NAME
77            
78             JCM::Boilerplate - Default Boilerplate for Joel's Code
79            
80             =head1 VERSION
81            
82             version 1.012
83            
84             =head1 SYNOPSIS
85            
86             use JCM::Boilerplate 'script';
87            
88             =head1 DESCRIPTION
89            
90             This module serves two purposes. First, it sets some default imports,
91             and turns on the strictures I've come to rely upon. Secondly, it depends
92             on a number of other modules to aid in setting up new environments (I can
93             just do a "cpan JCM-Boilerplate" to install everything I need).
94            
95             This module optionally takes one of two parameters, 'script', 'class',
96             or 'role'. If 'script' is specified, the module assumes that you do not
97             need Moose or MooseX modules.
98            
99             =head1 WARNINGS
100             This module makes significant changes in the calling package!
101            
102             In addition, this module should be incorporated into any project by
103             copying it into the project's library tree. This protects the project from
104             outside dependencies that may be undesired.
105            
106             =head1 AUTHOR
107            
108             Joel Maslak <jmaslak@antelope.net>
109            
110             =head1 COPYRIGHT AND LICENSE
111            
112             This software is copyright (c) 2015,2016 by Joel Maslak.
113            
114             This is free software; you can redistribute it and/or modify it under
115             the same terms as the Perl 5 programming language system itself.
116            
117             =cut
118