develooper Front page | perl.perl5.porters | Postings from April 2017

[PATCH] prevent mro.pm from loading DynaLoader

Thread Next
From:
Graham Knop
Date:
April 15, 2017 14:23
Subject:
[PATCH] prevent mro.pm from loading DynaLoader
Message ID:
20170415142311.68996-1-haarg@haarg.org
XSLoader::load cares about the package it is called from.  If it is a
different package from what you are trying to load, it falls back to
loading and using DynaLoader.

Move the load call to be in the mro package as it should be, so that it
doesn't trigger needless extra load.
---
 ext/mro/mro.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ext/mro/mro.pm b/ext/mro/mro.pm
index 92e8ca38cb..ce928489d5 100644
--- a/ext/mro/mro.pm
+++ b/ext/mro/mro.pm
@@ -14,6 +14,9 @@ package mro;
 #  for partial back-compat to 5.[68].x
 our $VERSION = '1.20';
 
+require XSLoader;
+XSLoader::load('mro');
+
 sub import {
     mro::set_mro(scalar(caller), $_[1]) if $_[1];
 }
@@ -37,9 +40,6 @@ sub method {
     return;
 }
 
-require XSLoader;
-XSLoader::load('mro');
-
 1;
 
 __END__
-- 
2.11.1

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About