The PL_FILES attribute allows you to specify the .PL files and which files they should modify. I add the $(INSTALLSITELIB) $(INSTALLSITEARCH) as arguments so the perl program will receive those macros from the makefile. Then, for example, I would transform a package like the following:WriteMakefile( NAME => 'Test::Bin', VERSION_FROM => 'lib/Test/Bin.pm', # finds $VERSION PREREQ_PM => {}, # e.g., Module::Name => 1.1 PL_FILES => { 'bin/test.PL $(INSTALLSITELIB) $(INSTALLSITEARCH)' => 'lib/Test/Bin.pm' }, );
by using this .PL file:package Test::Bin; use 5.008002; use strict; use warnings; use '###LIBPREFIX###'; # Use some easily matchable phrases use '###ARCPREFIX###'; 1; __END__
The end result is at least similar to what you are looking for:#!/usr/bin/perl -w -pi~ # Use command line options to read and write file(s). use strict; our ($lib, $arc); BEGIN { $lib = shift @ARGV; # Shift off the arguments so they are $arc = shift @ARGV; # not processed as files } s/\Q###LIBPREFIX###\E/$lib/; # perform substitutions s/\Q###ARCPREFIX###\E/$arc/; 1; __END__
Hope this helps.package Test::Bin; use 5.008002; use strict; use warnings; use '/home/orderthruchaos/local/lib/perl5/site_perl/5.8.2'; use '/home/orderthruchaos/local/lib/perl5/site_perl/5.8.2/i686-linux'; require Exporter; our $VERSION = '0.01'; 1; __END__
In reply to Re: Variable to point to library?
by orderthruchaos
in thread Variable to point to library?
by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |