Skip to content

Commit

Permalink
Only test on Perl 5.30. Add compat::p7 to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
davorg committed Jul 13, 2020
1 parent a6d4473 commit d7e3e25
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
16 changes: 0 additions & 16 deletions .travis.yml
Expand Up @@ -3,22 +3,6 @@ language: perl
matrix:
include:
- perl: "5.30"
- perl: "5.28"
- perl: "5.26"
- perl: "5.24"
- perl: "5.22"
- perl: "5.20"
dist: trusty
- perl: "5.18"
dist: trusty
- perl: "5.16"
dist: trusty
- perl: "5.14"
dist: trusty
- perl: "5.12"
dist: trusty
- perl: "5.10"
dist: trusty

before_install:
- sudo apt-get install libinline-perl libogg-dev libvorbis-dev
Expand Down
49 changes: 49 additions & 0 deletions lib/compat/perl7.pm
@@ -0,0 +1,49 @@
=head1 compat::perl7
=head2 Subroutines
=head3 import
Do the clever stuff.
=cut

package compat::perl7;

# use compat::perl7 enables perl 5 code to function in a perl 7-ish way as much as possible compared to the version you are running.
# it also is a hint to both tools and the compiler what the level of compatibility is with future versions of the language.

BEGIN {
# This code is a proof of concept provided against 5.30. In order for this code to work on other versions of perl
# we would need to generate it via p7.pm.PL as part of shipping it to CPAN.
$] >= 5.030 && $] < 5.031 or die("Perl 5.30 is required to use this module.");
}

sub import {

# use warnings; no warnings qw/experimental/;
# perl -e'use warnings; no warnings qw/experimental/; my $w; BEGIN {$w = ${^WARNING_BITS} } print unpack("H*", $w) . "\n"'
${^WARNING_BITS} = pack( "H*", "55555555555555555555555515000440050454" );

# use strict; use utf8;
# perl -MData::Dumper -e'my $h; use strict; use utf8; use feature (qw/bitwise current_sub declared_refs evalbytes fc postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings/); BEGIN { $h = $^H } printf("\$^H = 0x%08X\n", $h); print Dumper \%^H; '
$^H = 0x1C820FE2;

%^H = (
'feature___SUB__' => 1,
'feature_bitwise' => 1,
'feature_evalbytes' => 1,
'feature_fc' => 1,
'feature_myref' => 1,
'feature_postderef_qq' => 1,
'feature_refaliasing' => 1,
'feature_say' => 1,
'feature_signatures' => 1,
'feature_state' => 1,
'feature_switch' => 1,
'feature_unicode' => 1,
'feature_unieval' => 1
);
}

1;

0 comments on commit d7e3e25

Please sign in to comment.