in reply to use lib connundrum

Tilde is a feature of the shell which Perl is probably not able to expand for you. You can substitute it with something like this:
use lib "$ENV{HOME}/public_html/PERL_TEST";
There's also no guarantee that you're going to have a HOME environment variable either.

A more reliable method might be something like this:
BEGIN { my $home = (getpwuid($<))[7]; # Current user use lib "$home/public_html/PERL_TEST"; }
Update:
The above was merely given as an example of how you can replace tilde for the current user, figuring it was fairly obvious how to retool it to be more generic. What I probably should've put was something like this:
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; }
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.

Replies are listed 'Best First'.
•Re: Re: use lib connundrum
by merlyn (Sage) on Dec 02, 2002 at 15:48 UTC
    There's also no guarantee that you're going to have a HOME environment variable either.
    More importantly, it'll definitely be the wrong HOME if I run your script rather than you.

    Even your second solution is wrong in this respect.

    The only solution is to fully hard-code the path. That's the point of "use lib", anyway!

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.