File Coverage

blib/lib/JCM/Boilerplate.pm
Criterion Covered Total %
statement 51 55 92.7
branch 10 14 71.4
condition n/a
subroutine 7 7 100.0
pod n/a
total 68 76 89.4


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.011';
9              
10 1     1   15169 use v5.22;
  1         2  
11              
12 1     1   4 use feature 'signatures';
  1         1  
  1         82  
13 1     1   8 no warnings 'experimental::signatures';
  1         6  
  1         27  
14              
15 1     1   449 use English;
  1         2571  
  1         4  
16 1     1   805 use Import::Into;
  1         2275  
  1         24  
17 1     1   490 use Smart::Comments;
  1         26132  
  1         5  
18              
19 4 50   4   5893 sub import($self, $type='script') {
  4 50       9  
  4 100       9  
  4         9  
  4         5  
20 4 50       24 ### assert: ($type =~ m/^(?:class|role|script)$/ms)
  0         0  
  0         0  
  0         0  
  0         0  
21            
22 4         5 my $target = caller;
23              
24 4         20 strict->import::into($target);
25 4         635 warnings->import::into($target);
26 4         489 autodie->import::into($target);
27              
28 4         23258 feature->import::into($target, ':5.22');
29              
30 4         883 utf8->import::into($target); # Allow UTF-8 Source
31              
32 4 100       1182 if ($type eq 'class') {
    100          
33 1         5 Moose->import::into($target);
34 1         336079 Moose::Util::TypeConstraints->import::into($target);
35 1         1370 MooseX::StrictConstructor->import::into($target);
36 1         22457 namespace::autoclean->import::into($target);
37             } elsif ($type eq 'role') {
38 1         7 Moose::Role->import::into($target);
39 1         3874 Moose::Util::TypeConstraints->import::into($target);
40 1         1318 MooseX::StrictConstructor->import::into($target);
41 1         425 namespace::autoclean->import::into($target);
42             }
43              
44 4         444 Carp->import::into($target);
45 4         673 English->import::into($target);
46 4         1666 Smart::Comments->import::into($target, '-ENV', '###');
47              
48 4         738 feature->import::into($target, 'postderef'); # Not needed if >= 5.23.1
49 4         552 feature->import::into($target, 'refaliasing');
50 4         522 feature->import::into($target, 'signatures'); # Not needed if >= 5.23.?
51 4         526 feature->import::into($target, 'switch');
52 4         493 feature->import::into($target, 'unicode_strings');
53 4         505 warnings->unimport::out_of($target, 'experimental::refaliasing');
54              
55 4 50       664 if ($PERL_VERSION lt v5.24.0) {
56 4         11 warnings->unimport::out_of($target, 'experimental::postderef');
57 4         502 warnings->unimport::out_of($target, 'experimental::signatures');
58             }
59              
60             # For "switch" feature
61 4         525 warnings->unimport::out_of($target, 'experimental::smartmatch');
62             }
63              
64             1;
65              
66             __END__
67              
68             =pod
69              
70             =encoding UTF-8
71              
72             =head1 NAME
73              
74             JCM::Boilerplate - Default Boilerplate for Joel's Code
75              
76             =head1 VERSION
77              
78             version 1.011
79              
80             =head1 SYNOPSIS
81              
82             use JCM::Boilerplate 'script';
83              
84             =head1 DESCRIPTION
85              
86             This module serves two purposes. First, it sets some default imports,
87             and turns on the strictures I've come to rely upon. Secondly, it depends
88             on a number of other modules to aid in setting up new environments (I can
89             just do a "cpan JCM-Boilerplate" to install everything I need).
90              
91             This module optionally takes one of two parameters, 'script', 'class',
92             or 'role'. If 'script' is specified, the module assumes that you do not
93             need Moose or MooseX modules.
94              
95             =head1 WARNINGS
96             This module makes significant changes in the calling package!
97              
98             In addition, this module should be incorporated into any project by
99             copying it into the project's library tree. This protects the project from
100             outside dependencies that may be undesired.
101              
102             =head1 AUTHOR
103              
104             Joel Maslak <jmaslak@antelope.net>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2015,2016 by Joel Maslak.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut