in reply to use lib connundrum
use lib "$ENV{HOME}/public_html/PERL_TEST";There's also no guarantee that you're going to have a HOME environment variable either.
Update:BEGIN { my $home = (getpwuid($<))[7]; # Current user use lib "$home/public_html/PERL_TEST"; }
While having a hard-coded path is one way to ensure that the application will work, having an application use libraries from the home directory of a particular user isn't all that unusual, although it can be confusing if not documented clearly.BEGIN { my $user = 'someuser'; my ($home) = (getpwnam($user))[7]; # Specific user die "Can't find user $user home directory\n" unless($home); use lib "$home/bin"; print $home; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
•Re: Re: use lib connundrum
by merlyn (Sage) on Dec 02, 2002 at 15:48 UTC |