Fix Perl 5.00503's whining about symbolic refs

Peter Pentchev <[email protected]> Sat, 13 Dec 2003 08:10:16 +0200
Newsgroups gmane.comp.tex.texi2html.devel
Message-ID <[email protected]>
--4VrXvz3cwkc87Wze
Content-Type: multipart/mixed; boundary="19uQFt6ulqmgNgg1"
Content-Disposition: inline


--19uQFt6ulqmgNgg1
Content-Type: text/plain; charset=windows-1251
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hi,

What do you think about the attached patch, which eliminates the use
of symbolic refs altogether, instead of working around them by
disabling the 'strict refs' pragma?  I committed this patch to
the FreeBSD port of texi2html just a couple of minutes ago, since
it was needed to fix the build under FreeBSD 4.x, which still uses
Perl 5.00503 by default.

Thanks for taking care of texi2html; keep up the good work!

G'luck,
Peter

--=20
Peter Pentchev	[email protected]    [email protected]    [email protected]
PGP key:	http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint	FDBA FD79 C26F 3C51 C95E  DF9E ED18 B68D 1619 4553
I am the meaning of this sentence.

--19uQFt6ulqmgNgg1
Content-Type: text/plain; charset=windows-1251
Content-Disposition: attachment; filename="texi2html-norefs.patch"
Content-Transfer-Encoding: quoted-printable

--- texi2html.pl.old	Sat Dec 13 07:39:45 2003
+++ texi2html.pl	Sat Dec 13 07:40:11 2003
@@ -174,7 +174,6 @@
             $ext
             $extensions
             $failed
-            $fh_name
             $file
             $first_index_chapter
             $first_line
@@ -4127,25 +4126,22 @@
 sub open
 {
     my($name) =3D @_;
+    local *FH;
=20
-    ++$fh_name;
-    no strict "refs";
-    if (open($fh_name, $name))
+    if (open(*FH, $name))
     {
-        unshift(@fhs, $fh_name);
+        unshift(@fhs, *FH);
     }
     else
     {
         warn "$ERROR Can't read file $name: $!\n";
     }
-    use strict "refs";
 }
=20
 sub init_input
 {
     @fhs =3D ();			# hold the file handles to read
     @input_spool =3D ();		# spooled lines to read
-    $fh_name =3D 'FH000';
     &open($docu);
 }
=20
@@ -4420,9 +4416,8 @@
         if ($style =3D~ /^\&/)
         {                       # custom
             $style =3D $';
-            no strict "refs";
-            $text =3D &$style($text, $texi_style);
-            use strict "refs";
+            eval "\$text =3D &$style(\$text, \$texi_style)";
+            die $@ if $@;
         }
         elsif ($style)
         {                       # good style

--19uQFt6ulqmgNgg1--

--4VrXvz3cwkc87Wze
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (FreeBSD)

iD8DBQE/2q1I7Ri2jRYZRVMRAgy/AJ0W3PJ4orDci7tqGpgK0ATwZ5RpSwCgkxkC
BIm/CTUg1pmRVqG+2/Ey3Ew=
=sxvS
-----END PGP SIGNATURE-----

--4VrXvz3cwkc87Wze--