File Coverage

blib/lib/Five/Twenty.pm
Criterion Covered Total %
statement 29 29 100.0
branch 4 6 66.6
condition 1 3 33.3
subroutine 6 6 100.0
pod n/a
total 40 44 90.9


line stmt bran cond sub pod time code
1             package Five::Twenty;
2 1     1   16416 use 5.020;
  1         3  
  1         33  
3 1     1   4 use warnings;
  1         1  
  1         28  
4 1     1   3 use strict;
  1         1  
  1         29  
5 1     1   4 use feature ':5.20';
  1         1  
  1         117  
6              
7 1     1   388 use Five::X;
  1         1  
  1         310  
8              
9             sub import {
10 1     1   7 my $class = shift;
11              
12 1         1 my @features;
13 1 50 33     9 if (@_ and $_[0] eq ':experimental') {
14 1         2 push @features, ('lexical_subs', 'postderef', 'postderef_qq', 'signatures');
15             };
16              
17 1         12 warnings->import();
18 1         18 strict->import();
19 1 50       4 if (@features) {
20 1         9 my @no_warnings = map "experimental::$_", grep !/_qq/, @features;
21 1         20 warnings->unimport(@no_warnings);
22              
23 1         3 for my $version (experimental_versions()) {
24 3 100       10 next if $] < $version;
25 2         2 warnings->unimport(@{ experimental_warnings($version) });
  2         3  
26             }
27             }
28 1         130 feature->import(':5.20', @features);
29             }
30              
31             1;
32              
33             =head1 NAME
34              
35             Five::Twenty - Enable 'strict', 'warnings' and 'features :5.20' in the calling code
36              
37             =head1 SYNOPSIS
38              
39             package MyPackage;
40             use Five::Eighteen;
41             # strict, warnings and featere :5.20
42              
43             Perl 5.18 introduces experimental features that warn. These warnings can be
44             switched off with special 'no warnings' catagories. Use the B<:experimental>
45             import-tag to enable these features without warnings.
46              
47             package MyPackage;
48             use Five::Eighteen ':experimantal';
49             # now you also have 'lexical subs', 'postderef', 'postderef_qq', 'signatures'
50              
51             =head1 COPYRIGHT
52              
53             (c) MMXV - Abe Timmerman
54              
55             =cut