| 1 | # | ||||||||||||||
| 2 | # Copyright (C) 2015,2016,2017 Joelle Maslak | ||||||||||||||
| 3 | # All Rights Reserved - See License | ||||||||||||||
| 4 | # | ||||||||||||||
| 5 | |||||||||||||||
| 6 | package File::FindStrings::Boilerplate; | ||||||||||||||
| 7 | # ABSTRACT: Default Boilerplate for Perl::Critic::Policy::BadStrings | ||||||||||||||
| 8 | 3 | $File::FindStrings::Boilerplate::VERSION = '1.000'; | |||||||||||||
| 9 | |||||||||||||||
| 10 | 3 | ▶ | use v5.22; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 11 | 3 | ▶ | use strict; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 12 | |||||||||||||||
| 13 | 3 | ▶ | use feature 'signatures'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 14 | 3 | ▶ | no warnings 'experimental::signatures'; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 15 | |||||||||||||||
| 16 | 3 | ▶ | use English; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 17 | 3 | ▶ | use Import::Into; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 18 | 3 | ▶ | use Smart::Comments; | ||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||
| 19 | |||||||||||||||
| 20 | 7 | ▶ | sub import ( $self, $type = 'script' ) { | ||||||||||||
|
Subroutine
import: called CC=6 SCAR=21.5
| |||||||||||||||
| 21 | 0 | ▶ | ### assert: ($type =~ m/^(?:class|role|script)$/ms) | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 22 | |||||||||||||||
| 23 | 7 | my $target = caller; | |||||||||||||
| 24 | |||||||||||||||
| 25 | 7 | strict->import::into($target); | |||||||||||||
| 26 | 7 | warnings->import::into($target); | |||||||||||||
| 27 | 7 | autodie->import::into($target); | |||||||||||||
| 28 | |||||||||||||||
| 29 | 7 | feature->import::into( $target, ':5.22' ); | |||||||||||||
| 30 | |||||||||||||||
| 31 | 7 | utf8->import::into($target); # Allow UTF-8 Source | |||||||||||||
| 32 | |||||||||||||||
| 33 | 7 | ▶ | if ( $type eq 'class' ) { | ||||||||||||
|
Branch: 2 branches
| |||||||||||||||
| 34 | 0 | Moose->import::into($target); | |||||||||||||
| 35 | 0 | Moose::Util::TypeConstraints->import::into($target); | |||||||||||||
| 36 | 0 | MooseX::StrictConstructor->import::into($target); | |||||||||||||
| 37 | 0 | namespace::autoclean->import::into($target); | |||||||||||||
| 38 | } elsif ( $type eq 'role' ) { | ||||||||||||||
| 39 | 0 | Moose::Role->import::into($target); | |||||||||||||
| 40 | 0 | Moose::Util::TypeConstraints->import::into($target); | |||||||||||||
| 41 | 0 | MooseX::StrictConstructor->import::into($target); | |||||||||||||
| 42 | 0 | namespace::autoclean->import::into($target); | |||||||||||||
| 43 | } | ||||||||||||||
| 44 | |||||||||||||||
| 45 | 7 | Carp->import::into($target); | |||||||||||||
| 46 | 7 | English->import::into($target); | |||||||||||||
| 47 | 7 | Smart::Comments->import::into( $target, '-ENV', '###' ); | |||||||||||||
| 48 | |||||||||||||||
| 49 | 7 | 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 | 7 | feature->import::into( $target, 'signatures' ); | |||||||||||||
| 54 | |||||||||||||||
| 55 | 7 | feature->import::into( $target, 'switch' ); | |||||||||||||
| 56 | 7 | feature->import::into( $target, 'unicode_strings' ); | |||||||||||||
| 57 | # warnings->unimport::out_of($target, 'experimental::refaliasing'); | ||||||||||||||
| 58 | 7 | warnings->unimport::out_of( $target, 'experimental::signatures' ); | |||||||||||||
| 59 | |||||||||||||||
| 60 | 7 | ▶ | if ( $PERL_VERSION lt v5.24.0 ) { | ||||||||||||
|
Branch: 1 branch
| |||||||||||||||
| 61 | 0 | warnings->unimport::out_of( $target, 'experimental::postderef' ); | |||||||||||||
| 62 | } | ||||||||||||||
| 63 | |||||||||||||||
| 64 | # For "switch" feature | ||||||||||||||
| 65 | 7 | warnings->unimport::out_of( $target, 'experimental::smartmatch' ); | |||||||||||||
| 66 | |||||||||||||||
| 67 | 7 | return; | |||||||||||||
| 68 | } | ||||||||||||||
| 69 | |||||||||||||||
| 70 | 3 | 1; | |||||||||||||
| 71 | |||||||||||||||
| 72 | __END__ | ||||||||||||||