Re: Add directories to @INC
Tom Phoenix wrote: On 3/26/07, Robert Hicks [EMAIL PROTECTED] wrote: Jeff Pang wrote: I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. Instead of being critical maybe you can have shown how to do it in a script or module sense? Instead of being critical, maybe you could have invoked the FAQ? From perlfaq8: How do I add a directory to my include path (@INC) at runtime? Here are the suggested ways of modifying your include path: the PERLLIB environment variable the PERL5LIB environment variable the perl -Idir command line flag the use lib pragma, as in use lib $ENV{HOME}/myown_perllib; The latter is particularly useful because it knows about machine depen- dent architectures. The lib.pm pragmatic module was first included with the 5.002 release of Perl. Cheers! --Tom Phoenix Stonehenge Perl Training Ah, a much better answer than mine surely! Thanks! Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Add directories to @INC
I see that there are a lot of people wanting to know how to add directories to their @INC permanently. I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); Restart apache and you should be good to go! Hope this helps.
Re: Add directories to @INC
I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
Jeff Pang wrote: I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. Instead of being critical maybe you can have shown how to do it in a script or module sense? Robert -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
On 3/26/07, Robert Hicks [EMAIL PROTECTED] wrote: Jeff Pang wrote: I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); This is not mod_perl list. Since we discuss about common perl scripts not mod_perl,so your way seems not useful here. Instead of being critical maybe you can have shown how to do it in a script or module sense? Instead of being critical, maybe you could have invoked the FAQ? From perlfaq8: How do I add a directory to my include path (@INC) at runtime? Here are the suggested ways of modifying your include path: the PERLLIB environment variable the PERL5LIB environment variable the perl -Idir command line flag the use lib pragma, as in use lib $ENV{HOME}/myown_perllib; The latter is particularly useful because it knows about machine depen- dent architectures. The lib.pm pragmatic module was first included with the 5.002 release of Perl. Cheers! --Tom Phoenix Stonehenge Perl Training -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
Lee Conine am Montag, 26. März 2007 16:03: Hello (just noted Tom Phoenix's answer with the hint to perlfaq8 after writing, but sending anyway...) I see that there are a lot of people wanting to know how to add directories to their @INC permanently. I accomplished this by adding the following line to the end of my startup.pl file: push(@INC, Put path to directory here); This appends the new library path to @INC. The usual method however is to prepend it to @INC, so the added paths are searched first. That would lead to unshift @INC, 'Put path to directory here'; Which is better expressed by (see perldoc lib) use lib 'Put path to directory here'; Since the startup script unter mod_perl is also used to preload modules - including your own, located in nonstandard paths - a better place to put it is the beginning of the startup script, as you usually put use libs at the beginning of non-mod_perl scripts and modules. And there is a PERL5LIB env variable too that can be populated with additional library paths and exported, f.e. export PERL5LIB=/opt/osf/lib:/opt/smf/lib:/opt/my_perl/lib so you don't have to change scripts or modules (by placing use libs in it). Dani -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
This appends the new library path to @INC. The usual method however is to prepend it to @INC, so the added paths are searched first. That would lead to unshift @INC, 'Put path to directory here'; Someone (including me) has mentioned many times,this couldn't work. You should: BEGIN { unshift @INC, 'Put path to directory here'; } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
Re: Add directories to @INC
Harry Putnam [EMAIL PROTECTED] wrote: Shishir K. Singh [EMAIL PROTECTED] writes: I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. Perhaps you may need to reinstall if you don't want to use -I !! Sorry Shishir, but I'm a little mystified by your answer. Are you saying there is no way to permanently add directories to @INC, or maybe that -I does that? How will a reinstall help? The 'permanent' @INC, the one in -V, is in the binary; you need to rebuild to change it. If you haven't already, check perlfaq8: How do I add a directory to my include path at runtime? For a few other suggestions. HTH -- Steve perldoc -qa.j | perl -lpe '($_)=m((.*))' -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add directories to @INC
From: Harry Putnam [EMAIL PROTECTED] Jenda Krynicky [EMAIL PROTECTED] writes: I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. What is your operating system? FreeBSD-4.6 and linux (redhat 7.3) The action I've described is on the FreeBSD box but it has come up on linux boxes before too. I see. Then AFAIK your best bet is to set the PERL5LIB system variable to a list of the directories you want to add. Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Add directories to @INC
I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Add directories to @INC
I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. Perhaps you may need to reinstall if you don't want to use -I !! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add directories to @INC
Shishir K. Singh [EMAIL PROTECTED] writes: I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. Perhaps you may need to reinstall if you don't want to use -I !! Sorry Shishir, but I'm a little mystified by your answer. Are you saying there is no way to permanently add directories to @INC, or maybe that -I does that? How will a reinstall help? -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Add directories to @INC
I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. Perhaps you may need to reinstall if you don't want to use -I !! Sorry Shishir, but I'm a little mystified by your answer. Are you saying there is no way to permanently add directories to @INC, or maybe that -I does that? How will a reinstall help? As far as I know, @INC gets it's value during installation and can't be changed runtime. Every time a new version is installed, the path(if new ) gets added to @INC. I am not sure if even -I will work if the parent path for your directory is not included in @INC. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Add directories to @INC
Page 300 of the Camel 3rd ed says: any modifications to @INC need to occur at compile time...You can do this with the lib pragma described in Chapter 31 or with a BEGIN block. I think what our colleague meant by reinstalling Perl is that doing so will enable you to tell Perl where to look for modules every time it compiles and executes a program, rather than having to explicitly modify @INC in-program. I have no idea about -I switches and such, I bow out gracefully to the in-house gurus there. =) cheers, nathanael -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Add directories to @INC
I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. Perhaps you may need to reinstall if you don't want to use -I !! Sorry Shishir, but I'm a little mystified by your answer. Are you saying there is no way to permanently add directories to @INC, or maybe that -I does that? How will a reinstall help? As far as I know, @INC gets it's value during installation and can't be changed runtime. Every time a new version is installed, the path(if new ) gets added to @INC. I am not sure if even -I will work if the parent path for your directory is not included in @INC. Sorry..I take back my words on -I. The -I will treat the directories as appended to @INC during runtime but won't change @INC. Another way would be to use pragma use lib /path in your script. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add directories to @INC
Harry -- ...and then Harry Putnam said... % % I've been pounding perldoc for a while this morning trying to find a % clear technique described to add directories to @INC (permanently). There are a number of ways to *update* @INC, but I know of no way to permanently *change* it. I think you're looking at a reinstall if you really, really need the latter. You can use -I as you mentioned; you can also set $PERLLIB or $PERL5LIB as in bash-2.05a$ env PERLLIB=/tmp/perllib PERL5LIB=/tmp/perl5lib perl -V | tail -15 Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under freebsd Compiled at Jul 4 2002 23:57:31 %ENV: PERL5LIB=/tmp/perl5lib PERLLIB=/tmp/perllib @INC: /tmp/perl5lib /home/davidtg/local/lib/perl5/5.6.1/freebsd/i386 /home/davidtg/local/lib/perl5/5.6.1 /home/davidtg/local/lib/perl5/site_perl/5.6.1/freebsd/i386 /home/davidtg/local/lib/perl5/site_perl/5.6.1 /home/davidtg/local/lib/perl5/site_perl (note that PERL5LIB overrides PERLLIB; try the above without PERL5LIB to see the difference); you can also 'use lib' as in bash-2.05a$ \ perl -e 'use lib (/tmp/perllib,/tmp/perl5lib); \ foreach (@INC) { print $_\n }' /tmp/perllib /tmp/perl5lib /home/davidtg/local/lib/perl5/5.6.1/freebsd/i386 /home/davidtg/local/lib/perl5/5.6.1 /home/davidtg/local/lib/perl5/site_perl/5.6.1/freebsd/i386 /home/davidtg/local/lib/perl5/site_perl/5.6.1 /home/davidtg/local/lib/perl5/site_perl . if you prefer to depend on the script instead of on the environment; there are probably other ways as well :-) HTH HAND :-D -- David T-G * It's easier to fight for one's principles (play) [EMAIL PROTECTED] * than to live up to them. -- fortune cookie (work) [EMAIL PROTECTED] http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg! msg28624/pgp0.pgp Description: PGP signature
Re: Add directories to @INC
From: Harry Putnam [EMAIL PROTECTED] I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. What is your operating system? Jenda === [EMAIL PROTECTED] == http://Jenda.Krynicky.cz == There is a reason for living. There must be. I've seen it somewhere. It's just that in the mess on my table ... and in my brain I can't find it. --- me -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Add directories to @INC
Jenda Krynicky [EMAIL PROTECTED] writes: I've been pounding perldoc for a while this morning trying to find a clear technique described to add directories to @INC (permanently). I'm sure its described somewhere but I'm not finding it. I know about the -I switch method but wanted to add certain directories permanently so perl -V will display them. What is your operating system? FreeBSD-4.6 and linux (redhat 7.3) The action I've described is on the FreeBSD box but it has come up on linux boxes before too. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]