in reply to Looking for suggestions for accessing/running scripts needed by a local Perl library

... Is there a better, more perlish way?

There is surely a more unixish way: create a user-specific usr dir with all its usual children (e.g. ~/usr/bin) at ~/usr

I install all my private/personal scripts (bash, applescript in your case) into ~/usr/bin

For my personal Perl modules, I set INSTALL_BASE=$ENV{HOME}.'/usr' in their Makefile.PL (ExtUtils::MakeMaker) or (for not forgetting this crucial parameter in the Makefile.PL when uploading to CPAN -- lots of times!) I use the command-line mantra: PERL_MM_OPT=INSTALL_BASE=~/usr perl Makefile.PL && make all && make test && make install In this way, the module (just this one time) is installed under ~/usr

Some of my modules provide scripts for command-line functionality. In this case I set EXE_FILES of ExtUtils::MakeMaker (an array of script filepathnames) in Makefile.PL and all are installed under ~/usr as per the INSTALL_BASE setting.

Finally, my bin-path, ld-library-path, INC, are all appended with the usual children of ~/usr (which mirrors the structure of /usr btw).

Bottom line: when in doubt I always create a Module.

And if the initial and final aim was just a command line Perl script, then so be it. I temporarily suspend my usual lazyness and take the extra step to peace of mind (future-proof is a word I encountered lately) with perl Makefile.PL && make all && make test && make install : a consistent and portable way for installing even the most trivial Perl script.

BTW, all my Perl modules' source dirs are living under (say) ~/PERLSRC . Whenever I want to migrate, circummigrate or emigrate, I just copy that dir to a stick and take it with me (I know I know, you gitters!). It's as good in my machine as in any other machine. A simple (Edit: edited the line below to use -execdir, i.e. execute inside the dirname of the matched file - it will fail if '.' is in the PATH, in which case you need to remove '.' from the PATH):

PERL_MM_OPT=INSTALL_BASE=~/usr find PERLSRC -type f -name 'Makefile.PL +' -exec echo \{\} \; -execdir perl \{\} \; -execdir make all \; -exec +dir make install \;

installs them as before for me. And if you want them installed in a certain order, then create a Makefile or a bash script.

Edit: just to clarify: the main idea is to place the scripts in standard locations which are in your INC/PATH and can be found with, say, File::Which. Also, when writing the above I had also in mind your meditation Tip: Create a "working" perl lib for your personal use

bw, bliako

  • Comment on Re: Looking for suggestions for accessing/running scripts needed by a local Perl library
  • Select or Download Code