... 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


In reply to Re: Looking for suggestions for accessing/running scripts needed by a local Perl library by bliako
in thread Looking for suggestions for accessing/running scripts needed by a local Perl library by nysus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.