Skip to content

Commit

Permalink
Switch some core modules to XSLoader
Browse files Browse the repository at this point in the history
RT 132080: Remove perl 5.006 compatibilities with DynaLoader and use
XSLoader directly.

The traditional boiler plate to use XSLoader for Perl > 5.006 or
DynaLoader, does not make sense for core modules in perl 5.28+.
  • Loading branch information
atoomic authored and toddr committed Nov 13, 2017
1 parent c0cc035 commit b9a5a78
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 22 deletions.
1 change: 1 addition & 0 deletions dist/PathTools/Changes
Expand Up @@ -3,6 +3,7 @@ Revision history for Perl distribution PathTools.
3.69
- avoid loading modules repeatedly at runtime
- replace 'use vars' by 'our'
- Switch to XSLoader from Dynaloader

3.68
- avoid warning from pre-5.8 code for detecting tainted values
Expand Down
19 changes: 5 additions & 14 deletions dist/PathTools/Cwd.pm
Expand Up @@ -2,7 +2,8 @@ package Cwd;
use strict;
use Exporter;

our $VERSION = '3.69';

our $VERSION = '3.70';
my $xs_version = $VERSION;
$VERSION =~ tr/_//d;

Expand Down Expand Up @@ -76,19 +77,9 @@ sub _vms_efs {


# If loading the XS stuff doesn't work, we can fall back to pure perl
if(! defined &getcwd && defined &DynaLoader::boot_DynaLoader) {
eval {#eval is questionable since we are handling potential errors like
#"Cwd object version 3.48 does not match bootstrap parameter 3.50
#at lib/DynaLoader.pm line 216." by having this eval
if ( $] >= 5.006 ) {
require XSLoader;
XSLoader::load( __PACKAGE__, $xs_version);
} else {
require DynaLoader;
push @ISA, 'DynaLoader';
__PACKAGE__->bootstrap( $xs_version );
}
};
if(! defined &getcwd && defined &DynaLoader::boot_DynaLoader) { # skipped on miniperl
require XSLoader;
XSLoader::load( __PACKAGE__, $xs_version);
}

# Big nasty table of function aliases
Expand Down
3 changes: 3 additions & 0 deletions dist/Time-HiRes/Changes
@@ -1,5 +1,8 @@
Revision history for the Perl extension Time::HiRes.

1.9747 [???]
- Switch to XSLoader from Dynaloader

1.9746 [2017-08-17]
- Unreliable t/usleep.t and t/utime.t tests [rt.cpan.org #122819]
Avoid testing for $dt = $t2 - $t1 and assuming $dt is less than
Expand Down
8 changes: 4 additions & 4 deletions dist/Time-HiRes/HiRes.pm
Expand Up @@ -4,9 +4,9 @@ package Time::HiRes;
use strict;

require Exporter;
require DynaLoader;
use XSLoader ();

our @ISA = qw(Exporter DynaLoader);
our @ISA = qw(Exporter);

our @EXPORT = qw( );
# More or less this same list is in Makefile.PL. Should unify.
Expand Down Expand Up @@ -49,7 +49,7 @@ our @EXPORT_OK = qw (usleep sleep ualarm alarm gettimeofday time tv_interval
stat lstat utime
);

our $VERSION = '1.9746';
our $VERSION = '1.9747';
our $XS_VERSION = $VERSION;
$VERSION = eval $VERSION;

Expand Down Expand Up @@ -90,7 +90,7 @@ sub import {
Time::HiRes->export_to_level(1, $this, @_);
}

bootstrap Time::HiRes;
XSLoader::load( 'Time::HiRes', $XS_VERSION );

# Preloaded methods go here.

Expand Down
3 changes: 3 additions & 0 deletions dist/Unicode-Normalize/Changes
@@ -1,5 +1,8 @@
Revision history for Perl extension Unicode::Normalize.

1.26 *** RELEASE DATE HERE ***
- Switch to XSLoader from Dynaloader

1.25 Wed Dec 16 03:05:57 UTC 2015
- Fix Normalize.xs to work on releases earlier than 5.8. The problem was
introduced in this module's version 1.24
Expand Down
8 changes: 4 additions & 4 deletions dist/Unicode-Normalize/Normalize.pm
Expand Up @@ -16,7 +16,7 @@ use Carp;

no warnings 'utf8';

our $VERSION = '1.25';
our $VERSION = '1.26';
our $PACKAGE = __PACKAGE__;

our @EXPORT = qw( NFC NFD NFKC NFKD );
Expand Down Expand Up @@ -56,9 +56,9 @@ require Exporter;

##### The above part is common to XS and PP #####

our @ISA = qw(Exporter DynaLoader);
require DynaLoader;
bootstrap Unicode::Normalize $VERSION;
our @ISA = qw(Exporter);
use XSLoader ();
XSLoader::load( 'Unicode::Normalize', $VERSION );

##### The below part is common to XS and PP #####

Expand Down

0 comments on commit b9a5a78

Please sign in to comment.