Hello Tom
I've been successful in getting my use lib statment to work by inserting the following statments in my .bash_profile file as follows....

  CGIDIR=$HOME/cgi-bin
  PMDIR=$CGIDIR/pm
  export CGIDIR PMDIR

Then in my CGI script I have...
  -------------------------------------------------
  use lib "$PMDIR";
  use WSP qw(%WSP);         # My web site parameter definitions

  print "Content-type: text/html\n\n";
  foreach $name (sort keys(%WSP)) {
      print "$name = $WSP{$name}<br>\n";
   }
  -------------------------------------------------
Where WSP is where I've define my web site parameters. I then print out those parameters and it all works.

However there is something that I don't understand.... Since I've defined CGIDIR and PMDIR shell variables in .bash_profile and exported them, they are available to be used in my CGI applications according to what I've read. And this is certainly true because my 'use lib "$PMDIR" ' statement has successfully utilized the PMDIR definition. What I don't understand then is why when I use the following print statements, I don't get the expected values. I get nothing....

  print  "CGIDIR [$CGIDIR]<br>";
  print  "PMDIR [$PMDIR]<br>";

Can you shed some light on this for me?
Thanks
Tony

Tony Frasketi wrote:

Hey Tom
Thanks for the response.
That's what I was afraid of and wanted to avoid - Having this in all my scripts. I think I'll look into the '~/.bashrc, ~/bash_profile, /etc/profile' route. If I can get that to work, then I'll have what I want.
Thanks for the help!
Tony Frasketi

Tom Allison wrote:

Tony Frasketi wrote:

Thanks Tom for the quick response... But could you please elaborate a bit on what these two lines do?

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

and where would I use them, in a single script? in all my scripts?
Thanks
Tony


Unfortunately it would be in all your scripts.
Unless...

you can either add something like this to you ~/.bashrc, ~/bash_profile, /etc/profile (depending on how you want to use it).

I have a similar issue with a Solaris box at work and can't get the right permissions to configure the files I need. So I have to wrap everything in a script and include that "export PERL5LIB" string in every single file that I run from crontab.

It's not as bad as it sounds. It's really better to run crontab jobs from wrapper scripts but sometimes I'm just lazy about it.





--
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