| 1 | package Say::Compat; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | use vars qw($VERSION); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 1 | $VERSION = 0.01; | |||||||||
| 8 | |||||||||||
| 9 | 1 | ▶ | sub import { | ||||||||
|
Subroutine
import: called CC=2 SCAR=7.8
| |||||||||||
| 10 | 1 | my $class = shift; | |||||||||
| 11 | 1 | my $caller = caller; | |||||||||
| 12 | |||||||||||
| 13 | 1 | ▶ | if( $] < 5.010 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 14 | 0 | require Perl6::Say; | |||||||||
| 15 | 0 | Perl6::Say->import; | |||||||||
| 16 | |||||||||||
| 17 | 1 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | 0 | *{$caller . '::say'} = \&Perl6::Say::say; | |||||||||
| 19 | } | ||||||||||
| 20 | else { | ||||||||||
| 21 | 1 | require feature; | |||||||||
| 22 | 1 | 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<say()> | ||||||||||
| 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<Perl6::Say>. | ||||||||||
| 45 | |||||||||||
| 46 | When used on 5.10 or later it will load the built in L<say()|feature>. | ||||||||||
| 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 | 1; | |||||||||