jmo has asked for the wisdom of the Perl Monks concerning the following question:
b.pm:package a; BEGIN { use Data::Dumper; print STDERR 'a:',Dumper \%INC; } use b; my $a = { foo => &b::bar () }; 1;
c.pm:package b; BEGIN { use Data::Dumper; print STDERR 'b:',Dumper \%INC; } use c; sub bar { 1; } 1;
running perl -c a.pm, except printing the %INC var in different states gives me:package c; BEGIN { use Data::Dumper; print STDERR 'c:',Dumper \%INC; } use a; 1;
Does anyone know why this happends? %INC holds all three modules. b.pm and c.pm both compile when doing perl -c on them. Also, removing "use c;" in b.pm makes a.pm compile.Undefined subroutine &b::bar called at a.pm line 7. Compilation failed in require at c.pm line 6. BEGIN failed--compilation aborted at c.pm line 6. Compilation failed in require at b.pm line 6. BEGIN failed--compilation aborted at b.pm line 6. Compilation failed in require at a.pm line 6. BEGIN failed--compilation aborted at a.pm line 6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Circular module dependencies
by herveus (Prior) on Oct 04, 2004 at 11:25 UTC | |
|
Re: Circular module dependencies
by Joost (Canon) on Oct 04, 2004 at 09:17 UTC | |
|
Re: Circular module dependencies
by simonm (Vicar) on Oct 05, 2004 at 16:55 UTC |