On Mon, Jan 14, 2002 at 11:13:27AM +0100, Rafael Garcia-Suarez wrote: > On 2002.01.13 22:25 Michael G Schwern wrote: > > Why would this: > > > > BEGIN { > > push @INC, 'foo'; > > } > > > > put 'foo' into @INC twice if it were compiled? The compiled program > > should not be storing the post-BEGIN value of @INC, it should store > > the original value at startup. > > The compilation occurs at CHECK-time, that is, after 'foo' has been pushed > into @INC.
I don't know if this is true, but it isn't relevent. Remember, BEGIN, INIT, CHECK, etc... time is only relevent to the current module being loaded/run. As this example shows, Bar.pm's code is run before even Foo.pm's BEGIN block. Replace -MBar with -MO=C and you get the idea. # ~/tmp/Foo.pm package Foo; BEGIN { push @INC, 'foo'; } print "\@INC as Foo has modified it\n"; print join "\n", @INC; # ~/tmp/Bar.pm package Bar; print "\@INC as Bar sees it\n"; print join "\n", @INC; $ bleadperl -I/home/schwern/tmp -MBar -wle 'use Foo' @INC as Bar sees it /home/schwern/tmp /usr/local/bleadperl/lib/5.7.2/ppc-linux-64int /usr/local/bleadperl/lib/5.7.2 /usr/local/bleadperl/lib/site_perl/5.7.2/ppc-linux-64int /usr/local/bleadperl/lib/site_perl/5.7.2 /usr/local/bleadperl/lib/site_perl .. @INC as Foo has modified it /home/schwern/tmp /usr/local/bleadperl/lib/5.7.2/ppc-linux-64int /usr/local/bleadperl/lib/5.7.2 /usr/local/bleadperl/lib/site_perl/5.7.2/ppc-linux-64int /usr/local/bleadperl/lib/site_perl/5.7.2 /usr/local/bleadperl/lib/site_perl .. foo -- Michael G. Schwern <[EMAIL PROTECTED]> http://www.pobox.com/~schwern/ Perl Quality Assurance <[EMAIL PROTECTED]> Kwalitee Is Job One We're talkin' to you, weaselnuts. http://www.goats.com/archive/000831.html