|
|
 |
 |
 |
 |
Perl Programming Language
|
 |
 |
 |
 |
 |
 |
 |
 |
A simple way to make a code folder available as a module
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) . -- http://dev.lazaridis.com/lang/wiki/Perl
Ilias Lazaridis <i @lazaridis.com> wrote: > 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? -- Tad McClellan SGML consulting t@augustmail.com Perl programming Fort Worth, Texas
Ilias Lazaridis <i @lazaridis.com> wrote: > 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 -- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GB
On May 24, 11:29 am, xhos@gmail.com wrote: > Ilias Lazaridis <i @lazaridis.com> wrote: > > 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.
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
On May 26, 12:41 am, Brad Baxter <baxter.b@gmail.com> wrote:
> On May 24, 11:29 am, xhos @gmail.com wrote: > > Ilias Lazaridis <i@lazaridis.com> wrote: > > > 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. > 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
Brad, That didn't work for me. This one did: perl -e 'print join "\n" , @INC' -- skywriter14
Brad Baxter <baxter.b @gmail.com> wrote: > On May 24, 11:29 am, xhos @gmail.com wrote: > > Ilias Lazaridis <i @lazaridis.com> wrote: > > > 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. > 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 -- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GB
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.) -- Affijn, Ruud "Gewoon is een tijger."
On May 27, 9:46 pm, "Dr.Ruud" <rvtol+n@isolution.nl> wrote:
> 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.) > -- > Affijn, Ruud > "Gewoon is een tijger."
Apologies to Brad and Dr. Ruud: both of these work perl -le 'print for @INC' perl -wle 'print for @INC' Doesnt work: perl -el 'print for @INC' So I learnt, that the e option should be adjucent to the code. You can say from that I am not a pro when it comes to one liners. I wrote most of my code on editors. Anyway, can anyone shed little more light about the gotchas regarding one liners? Or did I discover the only one?
skywriter14 wrote: > Doesnt work: > perl -el 'print for @INC' > So I learnt, that the e option should be adjucent to the code.
Same caveat applies to any perl command-line switch that takes an argument. OK: perl -pi.bak -e 's/FIRST/SECOND/g' * perl -pi -e 's/FIRST/SECOND/g' * Not OK: perl -pie 's/FIRST/SECOND/g' * Also look at 'perldoc perlrun' to see how -l and -0 are sensitive to order. -Joe
On May 24, 6:29 pm, xhos@gmail.com wrote: > Ilias Lazaridis <i @lazaridis.com> wrote: > > 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?
(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. > > 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.
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) . -- http://dev.lazaridis.com/lang/wiki/Perl
testing reply, google
Ilias Lazaridis <i @lazaridis.com> wrote: > On May 24, 6:29 pm, xhos @gmail.com wrote: > > Ilias Lazaridis <i @lazaridis.com> wrote: > > > 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"). > > 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?
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 -- -------------------- http://NewsReader.Com/ -------------------- Usenet Newsgroup Service $9.95/Month 30GB
Ilias Lazaridis <i @lazaridis.com> writes: > 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?
Put your files into the correct folder. Perl maps package names directly to folder names when searching for modules. sherm-- -- Web Hosting by West Virginians, for West Virginians: http://wv-www.net Cocoa programming in Perl: http://camelbones.sourceforge.net
On May 31, 7:13 pm, xhos@gmail.com wrote:
> Ilias Lazaridis <i @lazaridis.com> wrote: > > On May 24, 6:29 pm, xhos @gmail.com wrote: > > > Ilias Lazaridis <i @lazaridis.com> wrote: > > > > 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"). > > > 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? > 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! . -- http://dev.lazaridis.com/lang/wiki/Perl
|
 |
 |
 |
 |
|