Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Newbie question on use

Reply
Thread Tools

Newbie question on use

 
 
chatiman
Guest
Posts: n/a
 
      02-20-2004
Hello again,

If i have 2 modules :

-------------------------
package A;

use lib "/path";
--------------------------
package B;

use A;
--------------------------

Will the package B search have "/path" in @INC ?



 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      02-20-2004
chatiman wrote:
> Hello again,
>
> If i have 2 modules :
>
> -------------------------
> package A;
>
> use lib "/path";
> --------------------------
> package B;
>
> use A;
> --------------------------
>
> Will the package B search have "/path" in @INC ?
>
>
>


Instead of asking, why not print it to see?
 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      02-20-2004
chatiman wrote:
> If i have 2 modules :
>
> -------------------------
> package A;
>
> use lib "/path";
> --------------------------
> package B;
>
> use A;
> --------------------------
>
> Will the package B search have "/path" in @INC ?


What happened when you tried it?

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

 
Reply With Quote
 
Beable van Polasm
Guest
Posts: n/a
 
      02-20-2004
"chatiman" <(E-Mail Removed)> writes:

> Hello again,
>
> If i have 2 modules :
>
> -------------------------
> package A;
>
> use lib "/path";


print("in package A, INC = @INC\n");

> --------------------------
> package B;
>
> use A;


print("in package B, INC = @INC\n");

> --------------------------
>
> Will the package B search have "/path" in @INC ?


Get the computer to tell you.


--

 
Reply With Quote
 
Anno Siegel
Guest
Posts: n/a
 
      02-20-2004
chatiman <(E-Mail Removed)> wrote in comp.lang.perl.misc:
> Hello again,
>
> If i have 2 modules :
>
> -------------------------
> package A;
>
> use lib "/path";
> --------------------------
> package B;
>
> use A;
> --------------------------
>
> Will the package B search have "/path" in @INC ?


What is the "package B search"?

Never mind, you decide, and when it happens, print @INC.

Anno
 
Reply With Quote
 
John W. Kennedy
Guest
Posts: n/a
 
      02-20-2004
Anno Siegel wrote:

> chatiman <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>
>>Hello again,
>>
>>If i have 2 modules :
>>
>>-------------------------
>>package A;
>>
>>use lib "/path";
>>--------------------------
>>package B;
>>
>>use A;
>>--------------------------
>>
>>Will the package B search have "/path" in @INC ?

>
>
> What is the "package B search"?
>
> Never mind, you decide, and when it happens, print @INC.


That doesn't tell whether it's defined behavior, you know.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 
Reply With Quote
 
Jimi-Carlo Bukowski-Wills
Guest
Posts: n/a
 
      02-20-2004
Since @INC is global, you should see /path in @INC in any script using
module A directly or indirectly. I've tested it and it works:
package A;

-------------------------
package A;
use lib "/path";
--------------------------
package B;
use A;
--------------------------
$ perl B.pl
/path
/usr/lib/perl5/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/5.8.1
/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.1
.....

Jimi



John W. Kennedy wrote:
> Anno Siegel wrote:
>
>> chatiman <(E-Mail Removed)> wrote in comp.lang.perl.misc:
>>
>>> Hello again,
>>>
>>> If i have 2 modules :
>>>
>>> -------------------------
>>> package A;
>>>
>>> use lib "/path";
>>> --------------------------
>>> package B;
>>>
>>> use A;
>>> --------------------------
>>>
>>> Will the package B search have "/path" in @INC ?

>>
>>
>>
>> What is the "package B search"?
>>
>> Never mind, you decide, and when it happens, print @INC.

>
>
> That doesn't tell whether it's defined behavior, you know.
>


 
Reply With Quote
 
Malcolm Dew-Jones
Guest
Posts: n/a
 
      02-20-2004
Jimi-Carlo Bukowski-Wills ((E-Mail Removed)) wrote:
: Since @INC is global, you should see /path in @INC in any script using
: module A directly or indirectly.

assuming you haven't local'ized @INC.


--
Web Work Wanted, Perl Projects Programmed, Database Development Done.

I'm looking for telecommute projects. (Paying that is, various
arrangements possible.)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VONAGE Newbie w/newbie question New_kid@nowhere.new VOIP 0 08-11-2007 01:40 PM
Newbie Question - Use Repeater? rhungund@gmail.com ASP .Net 4 12-13-2005 10:55 PM
another newbie question from another newbie.... Lee UK VOIP 4 05-17-2005 04:10 PM
newbie: cisco vlan newbie question No Spam Cisco 3 06-07-2004 10:02 AM
dumb newbie question (or newbie dumb question) Jerry C. Perl Misc 8 11-23-2003 04:11 AM



Advertisments