Tony Frasketi wrote:
Hello listers

I'm trying to use the following 'use lib' statement as described at....
    http://www.unix.org.ua/orelly/perl/prog3/ch31_13.htm

    use lib "$ENV{HOME}/libperl"; # add ~/libperl

In a *test* program, I've written....

    $ENV{HOME} = 'home/tony/cgi-bin'; # My cgi-bin directory
use lib "$ENV{HOME}/pm"; # Add my personal perl module directory (pm)

However this method doesn't seem to work for me... printing out @INC gives me... 0 /pm <-----------------------Incorrect/incomplete location of my personal perl module directory
1 /usr/lib/perl5/5.6.1/i386-linux
2 /usr/lib/perl5/5.6.1
3 /usr/lib/perl5/site_perl/5.6.1/i386-linux
4 /usr/lib/perl5/site_perl/5.6.1
5 /usr/lib/perl5/site_perl/5.6.0
6 /usr/lib/perl5/site_perl
7 /usr/lib/perl5/vendor_perl/5.6.1/i386-linux
8 /usr/lib/perl5/vendor_perl/5.6.1
9 /usr/lib/perl5/vendor_perl
10 .


However if I use the following...

    use lib "home/tony/cgi-bin/pm";

This works! printing out @INC give me....
0 /home/tonysf/cgi-bin/pm <----------------------- Correct Location of my personal perl module directory (pm)
1 /usr/lib/perl5/5.6.1/i386-linux
2 /usr/lib/perl5/5.6.1
3 /usr/lib/perl5/site_perl/5.6.1/i386-linux
4 /usr/lib/perl5/site_perl/5.6.1
5 /usr/lib/perl5/site_perl/5.6.0
6 /usr/lib/perl5/site_perl
7 /usr/lib/perl5/vendor_perl/5.6.1/i386-linux
8 /usr/lib/perl5/vendor_perl/5.6.1
9 /usr/lib/perl5/vendor_perl
10 .


What I'm trying to avoid is having all my scripts platform dependent by hard coding my personal perl module directory in the 'use lib' statement. I'd like to set the actual $ENV{HOME}environment variable in my home script to the location of my cgi-bin directory and have it applied automatically to all my scripts simply by referencing $ENV{HOME}..

Hoping I've explained this properlu
Thanks in advance.
tony



I didn't think you could interpret the variable $HOME or $ENV{HOME} in single quotes.

'$ENV{HOME}' is literally what you see.
"$ENV{HOME}" would get you /home/username/

But under use libs, it seems that they are all interpreted...

The only suggestion this noob has is to wrap it up into a shell script:

export PERL5LIB=$PERL5LIB:$HOME/lib
myperlscript.pl



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to