Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
>some of my files conflicted with system ones

That's the reason I keep all my own modules within the namespace "Misc";
and the physical location is /home/micha/prog/perl/Misc,
having a symbolic link in /etc/perl/Misc.

I don't know if there's a general preferred way.
But this did work out for me.

Having a unmodified homebrew perl installation on osx darwin here, I just looked the include path up:

~$ perl -e 'print map { "$_\n" } @INC' /usr/local/Cellar/perl/5.26.2/lib/perl5/site_perl/5.26.2/darwin-thread +-multi-2level /usr/local/Cellar/perl/5.26.2/lib/perl5/site_perl/5.26.2 /usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2/darwin-thread-multi-2le +vel /usr/local/Cellar/perl/5.26.2/lib/perl5/5.26.2 /usr/local/lib/perl5/site_perl/5.26.2
So, I might prepend a BEGIN block and push the local path to @INC.

..
I just looked it up, here's what I did in a script some time before:

BEGIN{ use File::Basename; ($name,$path,$suffix) = fileparse ($0); print "path: $path"; push @INC, "$path/perl"; }

I guess, there I followed the logic: Wherever this script lives, I'm going to store my modules within the same directory.

In each case I'd recommend working with links to your (home) modules directory,
just to keep things more tidy.

And I'm utilizing github for storing backups / revision control.

Finally, into some scripts I copied every module needed, also cpan modules, getting a huge single script.

These are scripts I can execute nearly everywhere, without any cpan installation.

I even built a statically linked perl out of this reason.
hth, Michael

In reply to Re: Best practices for local libraries by misc
in thread Best practices for local libraries by Barrabas

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-23 23:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found