develooper Front page | perl.module.build | Postings from June 2010

Tweak t/lib/MBTest.pm to work with ccache in core

From:
Nicholas Clark
Date:
June 29, 2010 10:46
Subject:
Tweak t/lib/MBTest.pm to work with ccache in core
Message ID:
20100629174647.GI17934@plum.flirble.org
I found I needed to make this change to t/lib/MBTest.pm to get it to work in
the perl core on machines using ccache.

Without it, $ENV{HOME} is set to a relative path, because at the time that the
BEGIN block runs to sets it, $cwd is not yet initialised, hence original_cwd()
returns a relative path, and then ccache gets upset and exits without
compiling, because it can't create $ENV{HOME}/.ccache

Nicholas Clark

----- Forwarded message from Nicholas Clark <nick@ccl4.org> -----

Envelope-to: nick@ccl4.org
Delivery-date: Tue, 29 Jun 2010 18:40:37 +0100
Mailing-List: contact perl5-changes-help@perl.org; run by ezmlm
Mail-Followup-To: perl5-porters@perl.org
Delivered-To: mailing list perl5-changes@perl.org
Delivered-To: perl5-changes@perl.org
From: "Nicholas Clark" <nick@ccl4.org>
To: perl5-changes@perl.org
Subject: [perl.git]  branch blead, updated. v5.13.2-103-ge812e1e
Reply-To: "Perl5 Porters" <perl5-porters@perl.org>
Date: Tue, 29 Jun 2010 19:40:23 +0200

In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/e812e1e8e98e6f2cf4362feff753023052129851?hp=686c4ca09cf9d6ae455bf0a013551e92f00e34fe>

- Log -----------------------------------------------------------------
commit e812e1e8e98e6f2cf4362feff753023052129851
Author: Nicholas Clark <nick@ccl4.org>
Date:   Tue Jun 29 18:25:29 2010 +0100

    When testing in core, ensure that the local $ENV{HOME} is absolute.
    
    Without this ppm.t and xs.t fail with ccache, because it can't create
    $ENV{HOME}/.ccache
-----------------------------------------------------------------------

Summary of changes:
 cpan/Module-Build/t/lib/MBTest.pm |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/cpan/Module-Build/t/lib/MBTest.pm b/cpan/Module-Build/t/lib/MBTest.pm
index 005920f..bf3cebd 100644
--- a/cpan/Module-Build/t/lib/MBTest.pm
+++ b/cpan/Module-Build/t/lib/MBTest.pm
@@ -97,8 +97,12 @@ __PACKAGE__->export(scalar caller, @extra_exports);
 
 # always return to the current directory
 {
-  my $cwd = File::Spec->rel2abs(Cwd::cwd);
+  my $cwd;
+  BEGIN {
+    $cwd = File::Spec->rel2abs(Cwd::cwd);
+  }
 
+  # This is called at BEGIN time below, so anything it uses must be initialised
   sub original_cwd { return $cwd }
 
   END {

--
Perl5 Master Repository

----- End forwarded message -----



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