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

[PATCH ext/SDBM_File/sdbm/Makefile.PL] MM hackery and whitespace changes

Thread Next
From:
Michael G Schwern
Date:
March 31, 2003 15:17
Subject:
[PATCH ext/SDBM_File/sdbm/Makefile.PL] MM hackery and whitespace changes
Message ID:
20030331231657.GJ17529@windhund.schwern.org
The SDBM_File issue on VMS seems to have been caused by this in
ext/SDBM_File/sdbm/Makefile.PL

sub MY::constants {
  package MY;
  my $r = shift->SUPER::constants();
  if ($^O eq 'VMS') {
    $r =~ s/^INST_STATIC =.*$/INST_STATIC = libsdbm\$(LIB_EXT)/m
  }
  return $r;
}

The formatting changed slightly in this version of MakeMaker.  Instead
of "INST_STATIC = ..." its "INST_STATIC   = ...".  Bad hackery.
I'd still like to know why that hack is there in the first place.

Anyhow, there's an easier way to do this now.

sub MY::constants {
    my $self = shift;
    $self->{INST_STATIC} = 'libsdbm$(LIB_EXT)';
    return $self->SUPER::constants;
}

Also, I can't really figure why that post_constants override is there.
It smells like some legacy from an age when the macro definitions weren't
quite so organized.  Together they were both there to override 
INST_STATIC to the same value.  So I removed it.

While I was at it, I cleaned up the top_targets() override to use the
$(NOECHO) macro.

--- ext/SDBM_File/sdbm/Makefile.PL	2003/03/31 23:03:37	1.1
+++ ext/SDBM_File/sdbm/Makefile.PL	2003/03/31 23:12:42
@@ -22,34 +22,21 @@
 );
 
 sub MY::constants {
-  package MY;
-  my $r = shift->SUPER::constants();
-  if ($^O eq 'VMS') {
-    $r =~ s/^INST_STATIC =.*$/INST_STATIC = libsdbm\$(LIB_EXT)/m
-  }
-  return $r;
-}
+    package MY;
+    my $self = shift;
+
+    $self->{INST_STATIC} = 'libsdbm$(LIB_EXT)';
 
-sub MY::post_constants {
-  package MY;
-  if ($^O eq 'VMS') {
-    shift->SUPER::post_constants();
-  } else {
-'
-INST_STATIC = libsdbm$(LIB_EXT)
-'
-  }
+    return $self->SUPER::constants();
 }
 
 sub MY::top_targets {
-    my $noecho = shift->{NOECHO};
-    
     my $r = '
 all :: static
-	' . $noecho . '$(NOOP)
+	$(NOECHO) $(NOOP)
 
 config ::
-	' . $noecho . '$(NOOP)
+	$(NOECHO) $(NOOP)
 
 lint:
 	lint -abchx $(LIBSRCS)
@@ -60,7 +47,7 @@
 # variables into the environment so $(MYEXTLIB) is set in here to this
 # value which can not be built.
 sdbm/libsdbm.a:
-	' . $noecho . '$(NOOP)
+	$(NOECHO) $(NOOP)
 ' unless $^O eq 'VMS';
 
     return $r;


-- 
SUBMIT TO MY LOVE, PUNY HUMAN!!!
        -- http://www.angryflower.com/deberg.gif

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