bug-gmp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

demos/perl/GMP/Mpf.pm: overload_string sets $^W incorrectly


From: Rob Nagler
Subject: demos/perl/GMP/Mpf.pm: overload_string sets $^W incorrectly
Date: Tue, 18 Jan 2005 16:53:49 -0700

Here's a patch to GMP 4.1.4 which fixes a problem caused by $^W being
set when it wasn't before the module was compiled.

Cheers,
Rob
----------------------------------------------------------------
Index: Mpf.pm
===================================================================
RCS file: /home/cvs/external/gmp/demos/perl/GMP/Mpf.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -c -r1.1 -r1.2
*** Mpf.pm      2005/01/05 20:12:50     1.1
--- Mpf.pm      2005/01/18 22:49:49     1.2
***************
*** 72,85 ****
  
  
  sub overload_string {
!   my $fmt;
!   BEGIN { $^W = 0; }
!   if (defined ($#)) {
!     $fmt = $#;
!     BEGIN { $^W = 1; }
      # protect against calling sprintf_internal with a bad format
      if ($fmt !~ /^((%%|[^%])*%[-+ .\d]*)([eEfgG](%%|[^%])*)$/) {
!       die "GMP::Mpf: invalid \$# format: $#\n";
      }
      $fmt = $1 . 'F' . $3;
    } else {
--- 72,90 ----
  
  
  sub overload_string {
!   my $w;
!   BEGIN {
!       $w = $^W;
!       $^W = 0;
!   }
!   my $fmt = $#;
!   BEGIN {
!       $^W = $w;
!   }
!   if (defined ($fmt)) {
      # protect against calling sprintf_internal with a bad format
      if ($fmt !~ /^((%%|[^%])*%[-+ .\d]*)([eEfgG](%%|[^%])*)$/) {
!       die "GMP::Mpf: invalid \$# format: $fmt\n";
      }
      $fmt = $1 . 'F' . $3;
    } else {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]