SUMMARY: Loading perl modules bassed on Solaris uname

From: Scot Needy (scot.needy@corp.infi.net)
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
/var/opt/modules/SunOS/5.6/lib);
   } elsif (($uname_s eq "SunOS") && ($uname_r eq 5.7)) {
      use lib qw(/var/opt/modules/SunOS/5.7
/var/opt/modules/SunOS/5.7/lib);
   } elsif (($uname_s eq "SunOS") && ($uname_r eq 5.8)) {
      use lib qw(/var/opt/modules/SunOS/5.8
/var/opt/modules/SunOS/5.8/lib);
   } else {
      die("$0 is only supported on Solaris 2.6, 2.7 & 2.8 \n");
   }

Scot

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
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:20 EDT