[Mpls-pm] System-context referencing of in-house perl libraries

Shane McCarron shane at aptest.com
Tue Feb 7 14:16:17 PST 2006


You can put your use lib statements in a BEGIN block... so you can do 
something like

BEGIN {

    if ($^O eq "MSWin32") {
       use lib whatever...
    } else {
       use lib unixy things
   }

}

James Oliver Smith, Jr wrote:
> Hi...
>
> I have a web-based system that I have developed here at the University 
> of Minnesota which currently runs on Solaris and Debian *nix systems, 
> and now needs to run on MS-XP as well.
>
> There is an extensive set of libraries that I use which I want to use on 
> MS-XP systems, as well as on the *nix systems.
>
> Currently, I use the following 'use' directories to reference these 
> libraries:
> ----------------------------------------
> use lib "/usr/local/bass/lib";
> use lib "/usr/local/bass/alder/lib";
> ----------------------------------------
>
> which will not work on MS-XP, which would need something like:
> ----------------------------------------
>   'c:\Program Files\bass\<libraries>'.
> ----------------------------------------
>
> What I would really like to be able to do is determine what kind of 
> system the system is running in and then determine which library paths 
> to use, depending on whether it is running on MS-XP or some other 
> systems. Eventually, I would like to run (potentially) multiple test 
> systems, each referencing a different version of the libraries.
>
> So, the question is, since the 'use lib' seems to be resolved at compile 
> time, how does one, within perl, reference different library locations 
> (but the same library synchronized via CVS) in a 
> system-context-sensitive manner, without using a predefined environemnt 
> variable?
>
> Any suggestions would be appreciated.
>
> Jim
>
>
>   

-- 
Shane P. McCarron                          Phone: +1 763 786-8160 x120
Managing Director                            Fax: +1 763 786-8180
ApTest Minnesota                            Inet: shane at aptest.com




More information about the Mpls-pm mailing list