SUMMARY: Loading perl modules bassed on Solaris uname

From: Scot Needy <>
Date: Wed May 15 2002 - 09:20:02 EDT
Thanks to those who responded. 

There are a few discussons on the net about this. Apparently the use 
statements are processed before ANY other perl code so... 

use lib $path is equal to use lib "NULL". 
You cannot use a variable yet because perl has not parsed that bit of
code that defines $path. 

The only way I am able to push a dynamic directory onto the INC array is
by wrapping perl in a shell script setting LD_LIBRARY_PATH or 
by adding a bit of ugly code. Still can't seem to get DynaLoader to look
in a different directory so all my .so files are in lib. 

use strict;
use POSIX qw(uname);
my ($uname_s, $uname_r)  = (POSIX::uname())[0,2];

if (($uname_s eq "SunOS") && ($uname_r eq 5.6)) {
      use lib qw(/var/opt/modules/SunOS/5.6
   } elsif (($uname_s eq "SunOS") && ($uname_r eq 5.7)) {
      use lib qw(/var/opt/modules/SunOS/5.7
   } elsif (($uname_s eq "SunOS") && ($uname_r eq 5.8)) {
      use lib qw(/var/opt/modules/SunOS/5.8
   } else {
      die("$0 is only supported on Solaris 2.6, 2.7 & 2.8 \n");


On Tue, 2002-05-14 at 16:06, scotrn wrote:
> Hi; 
>  I was wondering if any of you have tried to dynamicly load 
> a module from a directory based on the rev of OS? 
> In other words....
> my ($uname_s, $uname_r) = split('\s',`uname -sr`);
> use lib "/share/local/modules/$uname_s"."/"."$uname_r";
> This seems to work but modules which use DynaLoader to load shared
> objects it's falling back to the original @INC and not looking in 
> my lib path. 
> Trying to support an NFS share which has multiple versions of compuled 
> modules bassed on OS Rev. 
> Thanks 
> Scot 
sunmanagers mailing list
Received on Wed May 15 14:31:45 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:43 EST