RE: Altering the @INC array

2001-06-21 Thread Sterin, Ilya

This is not related to DBI although you are using this module.  It doesn't
even look like you made an attempt to look it up in the reference.  @INC is
an array, so how do you alter/add to an array?  I would answer but that
would promote OT questions, and now that groups.google.com is available,
it's very easy to post to comp.lang.perl.misc.

Ilya

-Original Message-
From: Mahdi A. Sbeih
To: [EMAIL PROTECTED]
Sent: 6/21/01 9:05 AM
Subject: Altering the @INC array
Importance: High

Hi all,

Is there a way to to alter the @INC array, the original @INC is:

/usr/local/lib/perl5/5.00503/sun4-solaris
/usr/local/lib/perl5/5.00503
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris
/usr/local/lib/perl5/site_perl/5.005

and I want my script to go to:

/export/home/mahdi/perl5/5.00503/sun4-solaris
/export/home/mahdi/perl5/5.00503
/export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
/export/home/mahdi/perl5/site_perl/5.005

Is this possible, I tried using use lib @my_INC like this, and when
printing the @INC
it is still the same as before:

#!/usr/local/bin/perl -w
@my_INC=qw(/export/home/mahdi/perl5/5.00503/sun4-solaris
/export/home/mahdi/perl5/5.00503
/export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
/export/home/mahdi/perl5/site_perl/5.005);
use lib @my_INC;
print (\n\n@INC\n\n);
use DBI;
use DBD::Informix::TechSupport;

print_versions(Perl DBI DBD::Informix ESQL/C Licence);

___
Mahdi A. Sbeih
Software Engineer
IDS Software Systems
http://www.idsusa.com
___



Re: Altering the @INC array

2001-06-21 Thread Berry Batist

 Is there a way to to alter the @INC array, the original @INC is:

 /usr/local/lib/perl5/5.00503/sun4-solaris
 /usr/local/lib/perl5/5.00503
 /usr/local/lib/perl5/site_perl/5.005/sun4-solaris
 /usr/local/lib/perl5/site_perl/5.005

 and I want my script to go to:

 /export/home/mahdi/perl5/5.00503/sun4-solaris
 /export/home/mahdi/perl5/5.00503
 /export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
 /export/home/mahdi/perl5/site_perl/5.005

Just add the extra search paths to your @INC array by doing:

sub BEGIN {
unshift(@INC, qw(
/export/home/mahdi/perl5/5.00503/sun4-solaris
/export/home/mahdi/perl5/5.00503
/export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
/export/home/mahdi/perl5/site_perl/5.005
)
);
}

Or do:

use lib qw(
/export/home/mahdi/perl50/5.00503/sun4-solaris
/export/home/mahdi/perl5/5.00503
/export/home/mahdi/perl5/site_perl/5.005/sun4-solaris
/export/home/mahdi/perl5/site_perl/5.005
);

If you print out the contents of your @INC array it will display
the additional paths.

Have fun ...

Berry