Change 29584 by [EMAIL PROTECTED] on 2006/12/18 15:36:11

        Subject: [PATCH blead] Re: [perl #41071] require stringifies code 
references in tied @INC
        From: Rick Delaney <[EMAIL PROTECTED]>
        Date: Fri, 15 Dec 2006 23:28:25 -0500
        Message-ID: <[EMAIL PROTECTED]>

Affected files ...

... //depot/perl/MANIFEST#1498 edit
... //depot/perl/pp_ctl.c#589 edit
... //depot/perl/t/op/inccode-tie.t#1 add
... //depot/perl/t/op/inccode.t#14 edit

Differences ...

==== //depot/perl/MANIFEST#1498 (text) ====
Index: perl/MANIFEST
--- perl/MANIFEST#1497~29580~   2006-12-18 05:34:00.000000000 -0800
+++ perl/MANIFEST       2006-12-18 07:36:11.000000000 -0800
@@ -3513,6 +3513,7 @@
 t/op/hash.t                    See if the complexity attackers are repelled
 t/op/hashwarn.t                        See if warnings for bad hash 
assignments work
 t/op/inccode.t                 See if coderefs work in @INC
+t/op/inccode-tie.t             See if tie to @INC works
 t/op/incfilter.t               See if the source filters in [EMAIL PROTECTED] 
work
 t/op/inc.t                     See if inc/dec of integers near 32 bit limit 
work
 t/op/index.t                   See if index works

==== //depot/perl/pp_ctl.c#589 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#588~29434~    2006-12-01 14:51:22.000000000 -0800
+++ perl/pp_ctl.c       2006-12-18 07:36:11.000000000 -0800
@@ -3150,6 +3150,8 @@
            for (i = 0; i <= AvFILL(ar); i++) {
                SV * const dirsv = *av_fetch(ar, i, TRUE);
 
+               if (SvTIED_mg((SV*)ar, PERL_MAGIC_tied))
+                   mg_get(dirsv);
                if (SvROK(dirsv)) {
                    int count;
                    SV **svp;

==== //depot/perl/t/op/inccode-tie.t#1 (text) ====
Index: perl/t/op/inccode-tie.t
--- /dev/null   2006-11-16 10:04:37.532058837 -0800
+++ perl/t/op/inccode-tie.t     2006-12-18 07:36:11.000000000 -0800
@@ -0,0 +1,15 @@
+#!./perl
+
+# Calls all tests in op/inccode.t after tying @INC first.
+
+use Tie::Array;
+my @orig_INC = @INC;
+tie @INC, 'Tie::StdArray';
[EMAIL PROTECTED] = @orig_INC;
+for my $file ('./op/inccode.t', './t/op/inccode.t', ':op:inccode.t') {
+    if (-r $file) {
+       do $file;
+       exit;
+    }
+}
+die "Cannot find ./op/inccode.t or ./t/op/inccode.t\n";

==== //depot/perl/t/op/inccode.t#14 (text) ====
Index: perl/t/op/inccode.t
--- perl/t/op/inccode.t#13~29236~       2006-11-08 07:33:02.000000000 -0800
+++ perl/t/op/inccode.t 2006-12-18 07:36:11.000000000 -0800
@@ -202,10 +202,12 @@
 
 {
     my $filename = $^O eq 'MacOS' ? ':Foo:Foo.pm' : './Foo.pm';
-    local @INC;
+    #local @INC; # local fails on tied @INC
+    my @old_INC = @INC; # because local doesn't work on tied arrays
     @INC = sub { $filename = 'seen'; return undef; };
     eval { require $filename; };
     is( $filename, 'seen', 'the coderef sees fully-qualified pathnames' );
+    @INC = @old_INC;
 }
 
 exit if $minitest;
End of Patch.

Reply via email to