VMS POD updates: perlport.pod, vmsperl.pod
[p5sagit/p5-mst-13.2.git] / vms / ext / XSSymSet.pm
index 679ede4..5fd59e7 100644 (file)
@@ -1,9 +1,8 @@
 package ExtUtils::XSSymSet;
 
-use Carp qw( &carp );
 use strict;
 use vars qw( $VERSION );
-$VERSION = '1.0';
+$VERSION = '1.1';
 
 
 sub new { 
@@ -37,9 +36,10 @@ sub trimsym {
     if (length $trimmed > $maxlen) {
       my $squeezed = $trimmed;
       my($xs,$prefix,$func) = $trimmed =~ /^(XS_)?(.*)_([^_]*)$/;
+      $xs ||= '';
+      my $frac = 3; # replaces broken length-based calculations but w/same result
+      my $pat = '([^_])';
       if (length $func <= 12) {  # Try to preserve short function names
-        my $frac = int(length $prefix / (length $trimmed - $maxlen) + 0.5);
-        my $pat = '([^_])';
         if ($frac > 1) { $pat .= '[^A-Z_]{' . ($frac - 1) . '}'; }
         $prefix =~ s/$pat/$1/g;
         $squeezed = "$xs$prefix" . "_$func";
@@ -50,8 +50,6 @@ sub trimsym {
         }
       }
       else { 
-        my $frac = int(length $trimmed / (length $trimmed - $maxlen) + 0.5);
-        my $pat = '([^_])';
         if ($frac > 1) { $pat .= '[^A-Z_]{' . ($frac - 1) . '}'; }
         $squeezed = "$prefix$func";
         $squeezed =~ s/$pat/$1/g;
@@ -69,7 +67,7 @@ sub trimsym {
       }
     }
   }
-  carp "Warning: long symbol $name\n\ttrimmed to $trimmed\n\t" unless $silent;
+  warn "Warning: long symbol $name\n\ttrimmed to $trimmed\n\t" unless $silent;
   return $trimmed;
 }
 
@@ -87,12 +85,12 @@ sub addsym {
     my($i) = "00";
     $trimmed = $self->trimsym($sym,$maxlen-3,$silent);
     while (exists $self->{"${trimmed}_$i"}) { $i++; }
-    carp "Warning: duplicate symbol $trimmed\n\tchanged to ${trimmed}_$i\n\t(original was $sym)\n\t"
+    warn "Warning: duplicate symbol $trimmed\n\tchanged to ${trimmed}_$i\n\t(original was $sym)\n\t"
       unless $silent;
     $trimmed .= "_$i";
   }
   elsif (not $silent and $trimmed ne $sym) {
-    carp "Warning: long symbol $sym\n\ttrimmed to $trimmed\n\t";
+    warn "Warning: long symbol $sym\n\ttrimmed to $trimmed\n\t";
   }
   $self->{$trimmed} = $sym;
   $self->{'__N+Map'}->{$sym} = $trimmed;