diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-08-09 17:48:49 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-08-09 17:48:49 +0000 |
commit | 069768bdb70fb3052599d3e70898a0ed0e1c31d2 (patch) | |
tree | 1492d59179e2c9b07cb6c6754f78a3ef6e608e68 /gnu/usr.bin/perl/pad.c | |
parent | f2ebe24544ebe30f7ed499fda280dce09361f966 (diff) |
Import of stock perl 5.8.5
Diffstat (limited to 'gnu/usr.bin/perl/pad.c')
-rw-r--r-- | gnu/usr.bin/perl/pad.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gnu/usr.bin/perl/pad.c b/gnu/usr.bin/perl/pad.c index 3f26d1a4f04..aabb2a1b7ed 100644 --- a/gnu/usr.bin/perl/pad.c +++ b/gnu/usr.bin/perl/pad.c @@ -1,6 +1,6 @@ /* pad.c * - * Copyright (C) 2002, by Larry Wall and others + * Copyright (C) 2002, 2003, 2004, by Larry Wall and others * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -83,6 +83,12 @@ is a CV representing a possible closure. (SvFAKE and name of '&' is not a meaningful combination currently but could become so if C<my sub foo {}> is implemented.) +The flag SVf_PADSTALE is cleared on lexicals each time the my() is executed, +and set on scope exit. This allows the 'Variable $x is not available' warning +to be generated in evals, such as + + { my $x = 1; sub f { eval '$x'} } f(); + =cut */ @@ -247,8 +253,11 @@ Perl_pad_undef(pTHX_ CV* cv) CV *innercv = (CV*)curpad[ix]; namepad[ix] = Nullsv; SvREFCNT_dec(namesv); - curpad[ix] = Nullsv; - SvREFCNT_dec(innercv); + + if (SvREFCNT(comppad) < 2) { /* allow for /(?{ sub{} })/ */ + curpad[ix] = Nullsv; + SvREFCNT_dec(innercv); + } if (SvREFCNT(innercv) /* in use, not just a prototype */ && CvOUTSIDE(innercv) == cv) { @@ -1479,6 +1488,9 @@ If has_args is true, give the new pad an @_ in slot zero. =cut */ +/* XXX pad_push is now always called with has_args == 1. Get rid of + * this arg at some point */ + void Perl_pad_push(pTHX_ PADLIST *padlist, int depth, int has_args) { |