in reply to Re: Re: import() not getting called. Huh?
in thread import() not getting called. Huh?

Sorry. I was mis-interpreting the output, but I tried something else

I commented out  #Err "NOT IMPLEMENTED YET."; line 183 of VA.pm and ran the following script.

package C1; use M1 v1.0 qw/&foo bar baz quux bazola $ztesch --dump/; #package C2; use M2 v1.0 qw/ foo baz $ztesch :tag1 --dump/; package C3; use M3 v1.0 qw/foo --dump/; print "so what?\n"; package C4; use M2 v2.3.4.5 qw/foo baz --dump/;

M3 was imported, but M2 fails with a version check failure, so I replaced the last line above with

package C4; use M2 v1.0 qw/foo baz --dump/;

And that gave me identical results. M3 imported, M2 fails?

Output

C:\test\EVA>test1 +++ I'm here! Exporter::VA import VERSION module M1 loaded +++ I'm here! M1 &foo bar baz quux bazola $ztesch --dump %EXPORT = bless( ( '&foo' => '&foo', '&baz' => '', '--verbose_import' => sub { "DUMMY" }, '.&unknown_type' => sub { "DUMMY" }, '.&begin' => sub { "DUMMY" }, '$ztesch' => '', '.&unknown_import' => sub { "DUMMY" }, '..worklist' => { 'C1::baz' => sub { "DUMMY" }, 'C1::ztesch' => \undef, 'C1::foo' => sub { "DUMMY" }, 'C1::bazola' => sub { "DUMMY" }, 'C1::quux' => sub { "DUMMY" }, 'C1::bar' => sub { "DUMMY" } }, '&quux' => \$EXPORT{'..worklist'}{'C1::quux'}, '..home' => 'M1', '--dump' => sub { "DUMMY" }, '.&end' => sub { "DUMMY" }, '.warnings' => 1, '..client_default_version' => { 'C1' => '☺ ' }, '&bar' => 'internal_bar', '&bazola' => sub { "DUMMY" }, '.check_user_option' => sub { "DUMMY" }, '.&unknown_feature' => sub { "DUMMY" } ), 'Exporter::VA' ); +++ I'm here! Exporter::VA :normal HASH(0x1f37668) module M3 loaded +++ I'm here! M3 foo --dump %EXPORT = bless( ( '.&unknown_import' => sub { "DUMMY" }, '..worklist' => {}, '&foo' => [ '☺ ', sub { "DUMMY" }, '☻ ', sub { "DUMMY" } ], '--verbose_import' => sub { "DUMMY" }, '..home' => 'M3', '.default_VERSION' => '☺♥', '--dump' => sub { "DUMMY" }, '.&unknown_type' => sub { "DUMMY" }, '.&end' => sub { "DUMMY" }, '.warnings' => 1, '.&begin' => sub { "DUMMY" }, '..client_default_version' => { 'C3' => '☺ ' }, '.check_user_option' => sub { "DUMMY" }, '.&unknown_feature' => sub { "DUMMY" } ), 'Exporter::VA' ); +++ I'm here! Exporter::VA :normal HASH(0x1f349e0) module M2 loaded M2 does not define $M2::VERSION--version check failed at C:\test\EVA\t +est1.pl line 4. BEGIN failed--compilation aborted at C:\test\EVA\test1.pl line 4. C:\test\EVA>

Then I moved the first M2 line below the M3 line; and again M3 imports but the M2 line--that works above it--fails when moved below it?

Again, I don't know if this helps any, but I thought I'd pass the information along in case it does. If this is another red-herring and you'd prefer not to get any more, just say so and I'll stop:).


Examine what is said, not who speaks.

Replies are listed 'Best First'.
Re: Re: Re: Re: import() not getting called. Huh?
by John M. Dlugosz (Monsignor) on Dec 20, 2002 at 20:52 UTC
    OK, so importing M1, M3, M2 in that order makes M2 fail with VERSION being not found, right? It's not complaining that the version number is bad, but that the VERSION function is not found at all, which is strange for a couple of reasons: (1) it works in other modules, and (2) if it was not defined it would be found in UNIVERSAL.

    But, it is calling M3::import in this case.

    I'm wondering if M3::import caused something to be changed (incorrectly) in M2, not just in C3 as intended. That "clobber the wrong thing" could explain my first observation, that a function was not being called, if the symbol table entry for that function were altered.

    What makes me suspect a compiler bug or other bizzare issue is that commenting out something that will happen later changes the behavior.

    Maybe using Dumper on the symbol table to see if/when something unexpected changes...I'm glad it's friday.

    —John