[X-Unix] Where to put my personal Perl Modules?

Brian Medley bpm-list-osx-unix at 4321.tv
Mon Jul 10 13:11:49 PDT 2006


On Mon, Jul 10, 2006 at 11:45:08AM -0700, Jerry Krinock wrote:

> I have written several perl scripts that I keep in ~/bin.  Also, ~/bin is in
> my bash PATH, so I can access them from any current directory.
> 
> But today I wrote a perl Module and added it as a subfolder to ~/bin.  If I
> cd to ~/bin and run a perl script which "uses" the Module from there, it
> works fine.  But if I'm somewhere else and type the command, relying on my
> bash PATH to find it, the perl compiler cannot find my module.  It's looking
> in all these system paths:
> 
> Can't locate SSLicensing/Generator.pm in @INC (@INC contains: /sw/lib/perl5
...
> BEGIN failed--compilation aborted at /Users/jk/bin/generateSN.pl line 2.
> 
> I hate installing things outside my home folder.  Is there a robust,
> non-kludgey solution to this?

You might try:

    use lib "$ENV{HOME}/bin";

    use Module;

-- 
~`^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-., \|/  (___)  \|/ _,.-=~'`^`
                                      @~./'O o`\.~@
      "Knowledge is Power"           /__( \___/ )__\  *PPPFFBT!*
         -- Francis Bacon               `\__`U_/'
 _.-=~'``'~=-._.-=~'``'~=-._.-=~'`^`'~= <____|'  ^^`'~=-.,__,.-=
~'^`'~=-._.-=~'`^`'~=-._.-=~'^'~=-.,__,.-==--^'~=-.,__,.-=~'`^`


More information about the X-Unix mailing list