Newbie question on use

Discussion in 'Perl Misc' started by chatiman, Feb 20, 2004.

  1. chatiman

    chatiman Guest

    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 ?
     
    chatiman, Feb 20, 2004
    #1
    1. Advertising

  2. chatiman

    J. Gleixner Guest

    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?
     
    J. Gleixner, Feb 20, 2004
    #2
    1. Advertising

  3. 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
     
    Gunnar Hjalmarsson, Feb 20, 2004
    #3
  4. "chatiman" <> 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.


    --
     
    Beable van Polasm, Feb 20, 2004
    #4
  5. chatiman

    Anno Siegel Guest

    chatiman <> 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
     
    Anno Siegel, Feb 20, 2004
    #5
  6. Anno Siegel wrote:

    > chatiman <> 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"
     
    John W. Kennedy, Feb 20, 2004
    #6
  7. 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 <> 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.
    >
     
    Jimi-Carlo Bukowski-Wills, Feb 20, 2004
    #7
  8. Jimi-Carlo Bukowski-Wills () 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.)
     
    Malcolm Dew-Jones, Feb 20, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry C.
    Replies:
    8
    Views:
    256
    Uri Guttman
    Nov 23, 2003
  2. Kruno Saho
    Replies:
    0
    Views:
    149
    Kruno Saho
    Apr 7, 2013
  3. Dave Angel
    Replies:
    0
    Views:
    130
    Dave Angel
    Apr 7, 2013
  4. rusi
    Replies:
    0
    Views:
    117
  5. Miki Tebeka
    Replies:
    0
    Views:
    88
    Miki Tebeka
    Apr 7, 2013
Loading...

Share This Page