You may wish to look at "BEGIN" ...

Hope that gives you some ideas...

Thanks,

jwm 

-----Original Message-----
From: Thompson, Glenn [mailto:[EMAIL PROTECTED] 
Sent: Thursday, July 29, 2004 10:54 AM
To: [EMAIL PROTECTED]
Subject: use lib - not known at compile time

I'm trying to add my own module "DEGS::ldegs" to a Perl program.
However, this module will part of a distribution called "RGSE",
which could be installed on a different path on different peoples PCs.
However, it will always be in the directory "$ENV{RGSE}/lib".

The problem is when I run the program I get an error like:

"Empty compile time value given to use lib at /home/gtho/Rgse/bin/depsol-gmt
line 44"

This presumably is because "use lib" cannot be used on a variable that is
undefined at compile time.

Now I know I can run the program in the following way:
        perl -I$ENV{RGSE}/lib myprogram.pl

which could easily be put in a wrapper shell script.

But is there anyway of avoiding this, and have "use lib" work on $ENV{RGSE}
"dynamically"?
Hopefully I'm missing something really simple here!

Here is a snippet from the program:

        use lib "$ENV{RGSE}/lib"; # directory when DEGS::ldegs is contained

        # Read necessary Perl libraries
        use DEGS::ldegs qw(&wait_for_enter &run &pythag &minmax &get_obj
&get_y_limits 
                        &page_get_size &set_tick_interval &add_legend
&get_lim2 
                        &page_setup_gm &add_fold_points);

Thanks,

Cheetah


*********************************************************************
This  e-mail  message,  and  any  files  transmitted  with  it, are
confidential  and intended  solely for the  use of the  addressee. If
this message was not addressed to  you, you have received it in error
and any  copying,  distribution  or  other use  of any part  of it is
strictly prohibited. Any views or opinions presented are solely those
of the sender and do not necessarily represent  those of the British
Geological  Survey. The  security of e-mail  communication  cannot be
guaranteed and the BGS accepts no liability  for claims arising as a
result of the use of this medium to  transmit messages from or to the
BGS. .                            http://www.bgs.ac.uk
*********************************************************************


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


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