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

[PATCH h2xs.PL perl@9423] h2xs -w nits

Thread Next
From:
Jonathan Stowe
Date:
March 29, 2001 00:32
Subject:
[PATCH h2xs.PL perl@9423] h2xs -w nits
Message ID:
Pine.LNX.4.30.0103290929130.19409-100000@orpheus.gellyfish.com
I inadvertently added a -w when editing the shebang line of the latest
h2xs - I thought I would fix the warnings rather than remove it :)

--- utils/h2xs.PL~	Thu Mar 29 07:41:19 2001
+++ utils/h2xs.PL	Thu Mar 29 09:25:39 2001
@@ -26,7 +26,7 @@
 # You can use $Config{...} to use Configure variables.

 print OUT <<"!GROK!THIS!";
-$Config{startperl}
+$Config{startperl} -w
     eval 'exec $Config{perlpath} -S \$0 \${1+"\$@"}'
 	if \$running_under_some_shell;
 !GROK!THIS!
@@ -471,7 +471,9 @@
 $opt_c = $opt_f = 1 if $opt_X;

 my %const_xsub = map { $_,1 } split(/,+/, $opt_s) if $opt_s;
-my $extralibs;
+
+my $extralibs = '';
+
 my @path_h;

 while (my $arg = shift) {
@@ -635,7 +637,8 @@


 my ($ext, $nested, @modparts, $modfname, $modpname);
-(chdir 'ext', $ext = 'ext/') if -d 'ext';
+
+$ext = chdir 'ext' ? 'ext/' : '';

 if( $module =~ /::/ ){
 	$nested = 1;
@@ -896,7 +899,7 @@
     my \$constname;
     $tmp
     (\$constname = \$AUTOLOAD) =~ s/.*:://;
-    croak "&$module::constant not defined" if \$constname eq 'constant';
+    croak "&${module}::constant not defined" if \$constname eq 'constant';
     my \$val = constant(\$constname, \@_ ? \$_[0] : 0);
     if (\$! != 0) {
 	if (\$! =~ /Invalid/ || \$!{EINVAL}) {
@@ -1196,7 +1199,7 @@
   for my $n (@$list) {
     my $c = substr $n, $off, 1;
     $leading{$c} = [] unless exists $leading{$c};
-    push @{$leading{$c}}, substr $n, $off + 1;
+    push @{$leading{$c}}, $off < length $n ? substr $n,  $off + 1 : $n
   }

   if (keys(%leading) == 1) {
@@ -1287,7 +1290,7 @@
 static int
 not_here(char *s)
 {
-    croak("$module::%s not implemented on this architecture", s);
+    croak("${module}::%s not implemented on this architecture", s);
     return -1;
 }

@@ -1298,8 +1301,7 @@

 print_tievar_subs(\*XS, $_, $vdecl_hash{$_}) for @vdecls;

-my $prefix;
-$prefix = "PREFIX = $opt_p" if defined $opt_p;
+my $prefix = defined $opt_p ? "PREFIX = $opt_p" : '';

 # Now switch from C to XS by issuing the first MODULE declaration:
 print XS <<"END";
@@ -1634,7 +1636,7 @@
   else {
     $type =~ s/$ignore_mods//go;
   }
-  $type =~ s/([^\s\w])/ \1 /g;
+  $type =~ s/([^\s\w])/ $1 /g;
   $type =~ s/\s+$//;
   $type =~ s/^\s+//;
   $type =~ s/\s+/ /g;
@@ -1745,7 +1747,7 @@
   print PL <<END;
     'LIBS'		=> ['$extralibs'], # e.g., '-lm'
     'DEFINE'		=> '$opt_F', # e.g., '-DHAVE_SOMETHING'
-$Icomment    'INC'		=> '$I', # e.g., '$Ihelp-I/usr/include/other'
+$Icomment    'INC'		=> '$I', # e.g., '${Ihelp}-I/usr/include/other'
 END

   my $C = grep $_ ne "$modfname.c", (glob '*.c'), (glob '*.cc'), (glob '*.C');



/J\
-- 
Jonathan Stowe                      |
<http://www.gellyfish.com>          |      This space for rent
                                    |


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