summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-10-31 20:46:02 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-10-31 20:46:02 +0000
commit18708f5a7334d978ddf7562cb7f58e28bec6e4ed (patch)
treefd546b7856fc3ed473e57722637cfad50805da86 /scope.c
parent539a3d6c530ba5e4a9bb32654bf5f07b038a4434 (diff)
downloadperl-18708f5a7334d978ddf7562cb7f58e28bec6e4ed.tar.gz
make nested ARGV/$^I loops work correctly; fixes several bugs
in the way ARGV state was handled in readline(); writing a subroutine to do inplace edits is now possible, provided *ARGV, *ARGVOUT, $^I and $_ are localized where needed p4raw-id: //depot/perl@4502
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/scope.c b/scope.c
index e86a9fe183..51aeed2dc0 100644
--- a/scope.c
+++ b/scope.c
@@ -279,9 +279,14 @@ Perl_save_gp(pTHX_ GV *gv, I32 empty)
if (empty) {
register GP *gp;
+ Newz(602, gp, 1, GP);
+
if (GvCVu(gv))
PL_sub_generation++; /* taking a method out of circulation */
- Newz(602, gp, 1, GP);
+ else if (GvIOp(gv) && (IoFLAGS(GvIOp(gv)) & IOf_ARGV)) {
+ gp->gp_io = newIO();
+ IoFLAGS(gp->gp_io) |= IOf_ARGV|IOf_START;
+ }
GvGP(gv) = gp_ref(gp);
GvSV(gv) = NEWSV(72,0);
GvLINE(gv) = PL_curcop->cop_line;