From: David Mitchell Date: Sun, 21 Mar 2010 14:17:13 +0000 (+0000) Subject: [perl #73626] get magic wasn't called on 3rd arg of open X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d71e3dc326c2464ea298c6a68a3c5ab7f611e6c1;p=p5sagit%2Fp5-mst-13.2.git [perl #73626] get magic wasn't called on 3rd arg of open Change f6c77cf1bf4d7cb2c7a64dd7608120b471f84062 introduced open($fh,"+<",undef) but in the process stopped calling mg_get() on the third arg, so tied values etc weren't getting processed --- diff --git a/doio.c b/doio.c index 87f2da0..eba7b54 100644 --- a/doio.c +++ b/doio.c @@ -214,7 +214,8 @@ Perl_do_openn(pTHX_ GV *gv, register const char *oname, I32 len, int as_raw, goto say_false; } #endif /* USE_STDIO */ - name = SvOK(*svp) ? savesvpv (*svp) : savepvs (""); + name = (SvOK(*svp) || SvGMAGICAL(*svp)) ? + savesvpv (*svp) : savepvs (""); SAVEFREEPV(name); } else { diff --git a/t/io/open.t b/t/io/open.t index 1a58327..443aab3 100644 --- a/t/io/open.t +++ b/t/io/open.t @@ -10,7 +10,7 @@ $| = 1; use warnings; use Config; -plan tests => 108; +plan tests => 109; my $Perl = which_perl(); @@ -310,3 +310,17 @@ fresh_perl_is( eval { open $99, "foo" }; like($@, qr/Modification of a read-only value attempted/, "readonly fh"); + +# [perl#73626] mg_get wasn't run on the pipe arg + +{ + package p73626; + sub TIESCALAR { bless {} } + sub FETCH { "$Perl -e 1"} + + tie my $p, 'p73626'; + + package main; + + ok( open(my $f, '-|', $p), 'open -| magic'); +}