Ronnie has asked for the wisdom of the Perl Monks concerning the following question:
This now works but originally the use lib was worded differently - use lib "$ENV{SECTRAN_DIR}/lib" ; This generated a compilation time error. Is this because the use lib is parsed at compile time and the SECTRAN_DIR variable is created at run time and therefore doesn't exist when the use lib is evaluated? Just trying to clear this up in my head. Cheers, Ronnie#!/usr/bin/perl -w # use strict ; # sub get_login_env { local %ENV; my $shell = shift || (getpwuid($<))[8]; my $env = `echo env | perl -e 'exec {"$shell"} -sh'`; if (wantarray) { my @pieces = ($env =~ m/^(.*?)=((?:[^\n\\]|\\.|\\\n)*)/gm); s/\\(.)/$1/g foreach @pieces; return @pieces; } else { return $env; } } # ############################################################### # Set up variables # ############################################################### # my $ftpfile = 'mailtest.pl' ; my $out_file = 'ronniesrubbish' ; my $result = 0 ; my $key = undef ; my $value = undef ; # print "\n\t\t<***** xxrcenv Starts *****>\n" ; # %ENV = (%ENV, get_login_env()); # while (($key, $value) = each (%ENV)) { print "\n\tKey :: $key" ; print "\n\tValue :: $value" ; } # print "\n" ; # use lib '/home/interface/sectran/lib' ; #use lib "$ENV{SECTRAN_DIR}/lib" ; foreach (@INC) { print "\t$_\n" ; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: UNIX/profile the sequel
by nimdokk (Vicar) on Nov 18, 2004 at 16:02 UTC | |
|
Re: UNIX/profile the sequel
by Happy-the-monk (Canon) on Nov 18, 2004 at 16:04 UTC | |
|
Re: UNIX/profile the sequel
by graff (Chancellor) on Nov 19, 2004 at 05:17 UTC |