A simple way to make a code folder available as a module

I

Ilias Lazaridis

I have a folder with several perl code modules, organized in several
sub-folders.

I've checked out the code via svn on several machines and things run
fine.

Now I have to make the code (under development) available system-wide.

I've looked in several articles and documentation, but got mostly
confused.

My questions are basicly:

a) How can I make aν svn checked out folder available as a system-wide
importable module (e.g. a command which adds the folder to the "perl
module search path").

b) How can I convert existing code into a module? (e.g. a command
which creates an installable package)

..
 
T

Tad McClellan

Ilias Lazaridis said:
I've looked in several articles and documentation,


Did they include the Perl FAQ?

perldoc -q module
My questions are basicly:

a) How can I make aν svn checked out folder available as a system-wide
importable module (e.g. a command which adds the folder to the "perl
module search path").


How do I keep my own module/library directory?

b) How can I convert existing code into a module? (e.g. a command
which creates an installable package)


How do I create a module?
 
X

xhoster

Ilias Lazaridis said:
I have a folder with several perl code modules, organized in several
sub-folders.

I've checked out the code via svn on several machines and things run
fine.

Now I have to make the code (under development) available system-wide.

What does "system" mean in this context? You said you have already done it
on several machines, so the "system" you are talking about seems be larger
than a single machine. This sound less like a Perl question and more
like a question for your system administrator. How do they roll out
new/upgraded tools to all the machines under their control? Do they have
one shared NSF drive or something?
My questions are basicly:

a) How can I make a=CE=BD svn checked out folder available as a
system-wide importable module (e.g. a command which adds the folder to
the "perl module search path").

run:
perl -le 'print "@INC"'

And see if any of those directories look like good places to install it.

Xho
 
B

Brad Baxter

run:
perl -le 'print "@INC"'

And see if any of those directories look like good places to install it.

A bit off topic: your use of -l made me wonder of you might have meant

perl -le 'print for @INC'

for a line-by-line list. Of course, if you said exactly what you
meant,
then never mind. :)
 
S

skywriter14

A bit off topic: your use of -l made me wonder of you might have meant

perl -le 'print for @INC'

for a line-by-line list. Of course, if you said exactly what you
meant,
then never mind. :)

Brad,
That didn't work for me.
This one did:
perl -e 'print join "\n" , @INC'
 
X

xhoster

Brad Baxter said:
A bit off topic: your use of -l made me wonder of you might have meant

perl -le 'print for @INC'

When I use -e, I almost always want -l as well. So now whenever I type -e,
my fingers automatically add the l all by themselves, which is usually a
good thing. So that is why the l was there.
for a line-by-line list. Of course, if you said exactly what you
meant,
then never mind. :)

I don't know why I didn't think of that, it looks much nicer than having
it all on one line and is less work to boot. Well, to be fair to myself,
I usually do think of that, I just didn't this time.

Xho
 
D

Dr.Ruud

skywriter14 schreef:

[perl -le 'print for @INC']
That didn't work for me.
This one did:
perl -e 'print join "\n" , @INC'

They should both work without problems. Try:

perl -wle 'print for @INC'

(In most Windows/DOS shells, you need to use doublequotes.)
 
I

Ilias Lazaridis

What does "system" mean in this context? You said you have already done it
on several machines, so the "system" you are talking about seems be larger
than a single machine. This sound less like a Perl question and more
like a question for your system administrator. How do they roll out
new/upgraded tools to all the machines under their control? Do they have
one shared NSF drive or something?

(this is basicly my 2nd reply, google groups has 'eaten' my 1st one)

you are right in asking me.

with "system" I meant "machine".

Thus, your suggestions below seems to do the work.
run:
perl -le 'print "@INC"'

And see if any of those directories look like good places to install it.

ok, but theres is a tiny problem.

if I place my folder "mycode" into

C:/Perl/site/lib

C:/Perl/site/lib/mycode

the "use" statements have to be corrected to start with "mycode::"

How can I avoid this?

(this is basicly my 2nd reply, google groups has 'eaten' my 1st one)

..
 
X

xhoster

Ilias Lazaridis said:
ok, but theres is a tiny problem.

if I place my folder "mycode" into

C:/Perl/site/lib

C:/Perl/site/lib/mycode

the "use" statements have to be corrected to start with "mycode::"

How can I avoid this?

By moving the the code up a level, so it no longer sits in mycode
directory, but rather directly in site/lib. Or, by changing mycode to
something better reflecting the nature of the code, for example your
company or department name, then just using it that way with the "::"

Xho
 
I

Ilias Lazaridis

By moving the the code up a level, so it no longer sits in mycode
directory, but rather directly in site/lib.

understand, but not possible.
Or, by changing mycode to
something better reflecting the nature of the code, for example your
company or department name, then just using it that way with the "::"

ok, I think I understand.

e.g. instead of "mycode" I would use "Lazaridis", resulting in

use Lazaridis::CoreLib

this is the same construct like in JAVA:

com.lazaridis.corelib

Thank you!

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,667
Latest member
DaniloB294

Latest Threads

Top