develooper Front page | perl.perl5.porters | Postings from August 2001

[PATCH perl@11597] B && BEGIN handling

Thread Next
From:
James A. Duncan
Date:
August 6, 2001 08:25
Subject:
[PATCH perl@11597] B && BEGIN handling
Message ID:
20010806172911.A2071@fotango.com
This patch alters intrpvar.h, perl.c, and B/B.xs to allow BEGINs
to be extracted at runtime.  Essentially it stops PL_minus_c from
being set, therefore stopping execution before runtime.  I'll
follow this shortly with a patch against B::Deparse along the lines 
of B::Deparse::coderef2text().

Regards,
James.

--- perl/intrpvar.h	Fri Jul 13 14:20:54 2001
+++ perl-current/intrpvar.h	Mon Aug  6 17:17:13 2001
@@ -22,6 +22,7 @@
 
 /* switches */
 PERLVAR(Iminus_c,	bool)
+PERLVAR(Isavebegin,     bool)
 PERLVAR(Ipatchlevel,	SV *)
 PERLVAR(Ilocalpatches,	char **)
 PERLVARI(Isplitstr,	char *,	" ")

--- perl/perl.c	Sat Aug  4 17:43:26 2001
+++ perl-current/perl.c	Mon Aug  6 17:17:27 2001
@@ -3860,7 +3860,7 @@
 
     while (AvFILL(paramList) >= 0) {
 	cv = (CV*)av_shift(paramList);
-	if ((PL_minus_c & 0x10) && (paramList == PL_beginav)) {
+	if (PL_savebegin && (paramList == PL_beginav)) {
 		/* save PL_beginav for compiler */
 	    if (! PL_beginav_save)
 		PL_beginav_save = newAV();

--- perl/ext/B/B.xs	Mon Jul  9 15:09:50 2001
+++ perl-current/ext/B/B.xs	Mon Aug  6 17:15:47 2001
@@ -528,7 +528,7 @@
 void
 save_BEGINs()
     CODE:
-	PL_minus_c |= 0x10;
+	PL_savebegin = TRUE;
 
 SV *
 cstring(sv)


-- 
James A. Duncan
Fiddle with something else, don't touch your toes.


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About