Peter Pentchev | 13 Dec 2003 07:10
Gravatar

Fix Perl 5.00503's whining about symbolic refs

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

-- 
Peter Pentchev	roam <at> ringlet.net    roam <at> sbnd.net    roam <at> FreeBSD.org
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.
--- texi2html.pl.old	Sat Dec 13 07:39:45 2003
+++ texi2html.pl	Sat Dec 13 07:40:11 2003
 <at>  <at>  -174,7 +174,6  <at>  <at> 
             $ext
             $extensions
             $failed
-            $fh_name
             $file
             $first_index_chapter
             $first_line
 <at>  <at>  -4127,25 +4126,22  <at>  <at> 
 sub open
 {
     my($name) =  <at> _;
+    local *FH;

-    ++$fh_name;
-    no strict "refs";
-    if (open($fh_name, $name))
+    if (open(*FH, $name))
     {
-        unshift( <at> fhs, $fh_name);
+        unshift( <at> fhs, *FH);
     }
     else
     {
         warn "$ERROR Can't read file $name: $!\n";
     }
-    use strict "refs";
 }

 sub init_input
 {
      <at> fhs = ();			# hold the file handles to read
      <at> input_spool = ();		# spooled lines to read
-    $fh_name = 'FH000';
     &open($docu);
 }

 <at>  <at>  -4420,9 +4416,8  <at>  <at> 
         if ($style =~ /^\&/)
         {                       # custom
             $style = $';
-            no strict "refs";
-            $text = &$style($text, $texi_style);
-            use strict "refs";
+            eval "\$text = &$style(\$text, \$texi_style)";
+            die $ <at>  if $ <at> ;
         }
         elsif ($style)
         {                       # good style

Gmane