[Edinburgh-pm] Embarrassingly n00bish question

Miles Gould miles at assyrian.org.uk
Fri Jul 8 13:38:31 PDT 2011


Hi everyone,

I've got a script, which I of course wrote in Perl. I now want to
re-use some code from it in another script, so I've started to do what
I should have done in the first place and factored the guts out into a
library. That library needs to be visible to the calling scripts:
what's the best way of ensuring this?

Currently, my situation is this:

1) The scripts live in a git repo in ~/src/monkey/simga.
2) The module lives in ~/src/monkey/simga/lib/Sim/GA.pm.
3) Tests... yeah, that would be a good idea.
4) ~/lib/perl5/Sim is a symlink to ~/src/monkey/simga/lib/Sim.
5) ~/bin contains symlinks to the scripts.
6) ~/lib/perl5 is added to PERL5LIB by my .bashrc.
7) Similarly, ~/bin is added to PATH.

[It''s a genetic algorithm that simulates an embedded processor
running benchmarks as its fitness function, in order to tune compiler
parameters. Hence "Sim::GA", and my angry tweets about genetic quanta
and simulators that think the way to handle SIGTERMs is to drop into a
debug prompt. ~/src/monkey started out as a directory for small
throwaway scripts: as was probably inevitable, it's where most of my
code now lives.]

This situation is no doubt terrible in even more ways than I've worked
out for myself. Surely there must be a Better Way. So, how do you all
handle this situation? What awesome tools should I be using to manage
my dists? What should I read to better understand how Perl dists are
meant to work?

TIA,
Miles.


More information about the Edinburgh-pm mailing list