Oops: Fix Glob.xs assertion failure
authorFather Chrysostomos <sprout@cpan.org>
Sat, 29 Oct 2011 07:34:17 +0000 (00:34 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 29 Oct 2011 07:34:17 +0000 (00:34 -0700)
This happens under :bsd_glob when <>/glob is called in list context.

ext/File-Glob/Glob.xs
ext/File-Glob/t/basic.t

index 2fed73b..1171769 100644 (file)
@@ -93,8 +93,10 @@ iterate(pTHX_ bool(*globber)(pTHX_ SV *entries, SV *patsv))
     }
 
     /* chuck it all out, quick or slow */
-    assert(SvROK(entriesv));
-    entries = (AV *)SvRV(entriesv);
+    if (!on_stack) {
+       assert(SvROK(entriesv));
+       entries = (AV *)SvRV(entriesv);
+    }
     if (gimme == G_ARRAY) {
        if (!on_stack) {
            Copy(AvARRAY(entries), SP+1, AvFILLp(entries)+1, SV *);
index 3fab895..bcd9999 100644 (file)
@@ -10,7 +10,7 @@ BEGIN {
     }
 }
 use strict;
-use Test::More tests => 48;
+use Test::More tests => 49;
 BEGIN {use_ok('File::Glob', ':glob')};
 use Cwd ();
 
@@ -281,3 +281,4 @@ for (qw[
 }
 is <a b>, 'a b', '<a b> under :bsd_glob';
 is <"a" "b">, '"a" "b"', '<"a" "b"> under :bsd_glob';
+is_deeply [<a b>], [q<a b>], '<> in list context under :bsd_glob';