RE: use lib - not known at compile time

From: John Moon (john.moon_at_myflorida.com)
Date: 07/29/04


To: "'Thompson, Glenn'" <gtho@bgs.ac.uk>, beginners@perl.org
Date: Thu, 29 Jul 2004 11:02:50 -0400

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

Hope that gives you some ideas...

Thanks,

jwm

-----Original Message-----
From: Thompson, Glenn [mailto:gtho@bgs.ac.uk]
Sent: Thursday, July 29, 2004 10:54 AM
To: beginners@perl.org
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: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Relevant Pages

  • Re: gcc 3 versions: calling conventions
    ... No of course not, but at compile time. ... an import lib to add the underscores to the old code. ... What about the possibility of creating DLLs from the old libs? ...
    (comp.os.os2.programmer.tools)
  • Re: how to use the pm in other location instead of current one.
    ... Franklin Lee wrote in comp.lang.perl.misc: ... > So I write below codes: ... The expression after "lib" is evaluated at compile time, ...
    (comp.lang.perl.misc)
  • Re: use lib question
    ... use warnings; ... use Env qw; ... Empty compile time value given to use lib at t11.pl line 5 ... I guess the problem is that 'use lib' runs at compile time and $XYZ is ...
    (comp.lang.perl.misc)
  • RE: use lib - not known at compile time
    ... > "Empty compile time value given to use lib at ... > that is undefined at compile time. ... I'm assuming the "use lib" line below is line 44. ... > which could easily be put in a wrapper shell script. ...
    (perl.beginners)
  • Re: IP address format
    ... Mike D Sutton wrote: ... >> What's the story (distribution) of that lib, ... > redistributable package for it a number of years ago?), ...
    (microsoft.public.vb.general.discussion)