File Coverage

blib/lib/Say/Compat.pm
Criterion Covered Total %
statement 17 21 80.9
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 23 28 82.1


line stmt bran cond sub pod time code
1             package Say::Compat;
2              
3 1     1   686 use strict;
  1         3  
  1         34  
4 1     1   5 use warnings;
  1         1  
  1         29  
5              
6 1     1   7 use vars qw($VERSION);
  1         4  
  1         154  
7             $VERSION = 0.01;
8              
9             sub import {
10 1     1   7 my $class = shift;
11 1         2 my $caller = caller;
12              
13 1 50       5 if( $] < 5.010 ) {
14 0         0 require Perl6::Say;
15 0         0 Perl6::Say->import;
16              
17 1     1   5 no strict 'refs';
  1         2  
  1         106  
18 0         0 *{$caller . '::say'} = \&Perl6::Say::say;
  0         0  
19             }
20             else {
21 1         7 require feature;
22 1         2095 feature->import("say");
23             }
24             }
25              
26              
27             =head1 NAME
28              
29             Say::Compat - Backwards compatibility wrapper for say()
30              
31             =head1 SYNOPSIS
32              
33             use Say::Compat;
34              
35             say "Hello world!";
36             say STDERR "Hello error!";
37              
38             =head1 DESCRIPTION
39              
40             This is a compatibility layer to allow Perl code to use C
41             without sacrificing backwards compatibility. Simply use the
42             module in your code and it will do the right thing.
43              
44             When used on a Perl before 5.10, it will load L.
45              
46             When used on 5.10 or later it will load the built in L.
47              
48             =head1 CAVEATS
49              
50             Perl6::Say does not fully emulate all the syntax of the real say.
51             Therefore, to avoid incompatibilities, you must code to its
52             limitations. See the documentation for Perl6::Say for details.
53              
54             Future versions may use a different module to emulate say, but
55             they will strive to avoid
56              
57             =cut
58              
59             1;