Good morning, and my apologies in advance for a rather long and meandering supplication.

I came across something puzzling yesterday evening; it may likely prove to be just an unremarkable example of the Fool Pattern, but anyway. I'm creating a module that fakes a particular environment, mainly by declaring big sets of global variables. It started a bit like this

package Totally::Fake; our @ISA = qw/Exporter/; our ($fake, @faker); @EXPORT = qw/$fake @faker/;

The dream was that I could easily check the perl scripts I wrote for this environment using 'perl -c -MTotally::Fake -Mstrict my_script.pl', and all the variables will be there and strict won't complain.

First thing I don't understand
This didn't work. my_script.pl would refer to $fake and strict would complain. So I tried making a little test script:

use Totally::Fake; use lib '/path/to/dev/version'; print $fake;

Second thing I don't understand:
This did work - but only because of the presence of the use lib declaration. I could add a non-existent path to @INC, so loading exactly the same version of Totally::Fake from /usr/lib/perl, and it would work, where it wouldn't without use lib. This seems really weird to me. Why should 'use lib' affect my exports?

Third thing I don't understand
So some poking and tinkering later, I happened to try 'use base qw/Exporter/' instead of 'our @ISA = qw/Exporter/' in my module ... and it finally worked how I'd like it to. Which is good, but bad. I had a look at the documentation for base. How does inheriting using base differ from declaring @ISA, so that one works here, and the other doesn't?

With thanks in advance
ViceRaid


In reply to Side effects of use-ing base (vs our @ISA) by ViceRaid

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.