DCPM: Can Makefile.PL accept command-line parameters?

Neil Williams linux at codehelp.co.uk
Sat Nov 15 09:08:42 CST 2003


I'm currently testing this patch to a Makefile.PL

--- Makefile.PL	Tue Sep 16 14:26:57 2003
+++ isbnsearchMakefile.PL	Wed Nov 12 14:09:27 2003
@@ -1,7 +1,32 @@
 # $Header: /home/cvsroot/NetZ3950/Makefile.PL,v 1.6 2003/05/09 10:33:23 mike 
Exp $

-my $yazinc = `yaz-config --cflags`;
-my $yazlibs = `yaz-config --libs`;
+# isbnsearch customisation enabler
+# Either call the script using a pipe:
+# echo "/home/user/path/" | perl isbnsearchMakeFile.PL
+# /home/user/path/ = path to yaz_config
+my $prefix;
+# OR: enter the same path and uncomment the next line:
+# Make sure path ends in /
+# $prefix = "";
+my $yazinc;
+my $yazlibs;
+if(!$prefix) {
+	while(<>) {
+		$prefix .= $_;
+	}
+}
+if($prefix) {
+	chomp($prefix);
+	$prefix .= "yaz-config";
+	$yazinc = qx/$prefix --cflags/;
+	$yazlibs = qx/$prefix --libs/;
+}
+else {
+	$yazinc = `yaz-config --cflags`;
+	$yazlibs = `yaz-config --libs`;
+}
+# end isbnsearch
+
 if (!$yazinc || !$yazlibs) {
     die "ERROR: Unable to call script 'yaz-config': is YAZ installed?";
 }


Yes, it's my old friend, Net::Z3950 again.

The problem is that using 
while(<>) {}
means that I can only pass the prefix using:
echo "/home/siteuser/path/" | perl Makefile.PL

The full documentation for what I'm trying to do is here:
http://www.isbn.org.uk/docs/install.html

Also, if I fail to pass something via echo, Perl hangs on the Makefile. 
Therefore, I've added a line that allows the prefix to be edited within the 
Makefile as well.
+# $prefix = "";

I'm looking for a more elegant way of doing it, so that instead of:
perl -MCPAN -e 'install Net::Z3950'

I can use:
download NetZ3950.pm
apply patch to Makefile.PL
perl Makefile.PL --prefix /home/siteuser/path/

Although I suspect Perl won't do that.

The path will differ for each user of the patch and I'm trying to reduce the 
workload / confusion.



-- 

Neil Williams
=============
http://www.codehelp.co.uk/
http://www.dclug.org.uk/
http://www.isbn.org.uk/
http://sourceforge.net/projects/isbnsearch/

http://www.biglumber.com/x/web?qs=0x8801094A28BCB3E3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: signature
Url : http://mail.pm.org/archives/devoncornwall-pm/attachments/20031115/467d6d81/attachment.bin


More information about the Devoncornwall-pm mailing list