On Mon Dec 15 05:32:02 2014, TSCH wrote:
Show quoted text> so we would impose a new
> install-time requirement for all our orthodox users, and even a new
> run-time dependency for everyone using Ed's new stuff.
My Inline-supporting patch doesn't create a run-time dependency; it produces data (in code form) that can optionally be consumed by other user code that wishes to use Inline.
I attach a patch to EUD with a test that without the .pm change passes on Linux, fails on Windows; with .pm change, passes on both.
If you like it and would like me to save you trouble and push it to the GNOME repo myself, let me know.
From 11306be3cd01fb3f282d85e143e40a6195f6516b Mon Sep 17 00:00:00 2001
From: Ed J <mohawk2@users.noreply.github.com>
Date: Thu, 1 Jan 2015 17:18:06 +0000
Subject: [PATCH] Use / to make ::load filename, not File::Spec - perldoc -f
require
---
lib/ExtUtils/Depends.pm | 3 ++-
t/02_save_load.t | 26 +++++++++++++++++++++++---
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/lib/ExtUtils/Depends.pm b/lib/ExtUtils/Depends.pm
index 8e2f916..74043e1 100644
--- a/lib/ExtUtils/Depends.pm
+++ b/lib/ExtUtils/Depends.pm
@@ -178,7 +178,8 @@ sub load {
my $dep = shift;
my @pieces = split /::/, $dep;
my @suffix = qw/ Install Files /;
- my $relpath = File::Spec->catfile (@pieces, @suffix) . '.pm';
+ # not File::Spec - see perldoc -f require
+ my $relpath = join('/', @pieces, @suffix) . '.pm';
my $depinstallfiles = join "::", @pieces, @suffix;
eval {
require $relpath
diff --git a/t/02_save_load.t b/t/02_save_load.t
index 83769fd..088af94 100644
--- a/t/02_save_load.t
+++ b/t/02_save_load.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
-use Test::More tests => 38;
+use Test::More tests => 40;
use FindBin;
use lib "$FindBin::Bin/lib";
@@ -44,7 +44,18 @@ $dep_info->install (@installed_files);
use Data::Dumper;
$Data::Dumper::Terse = 1;
-$dep_info->save_config (catfile $tmp_inc, qw(DepTest Install Files.pm));
+my $IFpm = catfile $tmp_inc, qw(DepTest Install Files.pm);
+$dep_info->save_config ($IFpm);
+
+{
+# ensure '/' used for config filename in require, not File::Spec
+open my $fh, '<', $IFpm or die "read $IFpm: $!";
+my $text = join '', <$fh>;
+close $fh;
+($text =~ s/1;\s*\Z/warn "LOADING\n";\n$&/) or die "Text substitution failed!";
+open $fh, '>', $IFpm or die "write $IFpm: $!";
+print $fh $text;
+}
# --------------------------------------------------------------------------- #
@@ -75,7 +86,16 @@ foreach my $file (@c_files, @xs_files) {
# --------------------------------------------------------------------------- #
-my $info = ExtUtils::Depends::load ('DepTest');
+my $info;
+{
+my $warning = '';
+local $SIG{__WARN__} = sub { $warning .= join '', @_; };
+$info = ExtUtils::Depends::load ('DepTest');
+like $warning, qr/LOADING/, 'loaded once';
+$warning = '';
+require DepTest::Install::Files;
+unlike $warning, qr/LOADING/, 'not loaded twice';
+}
my $install_part = qr|DepTest.Install|;
like ($info->{inc}, $install_part, "loaded inc");
--
2.1.0