syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
On win32, build 817 (perl 5.8.8) of ActivePerl my 'perl -V:xxxx' commands have decided to stop working.Here's an example:
D:\>perl -V:useperlio &Config::AUTOLOAD failed on Config::launcher at E:/Perl817/lib/Config. +pm line 72.

I traced the problem back to the AUTOLOAD subroutine in Config.pm. For debugging, I inserted a print() into that sub. It now looks like this:
sub AUTOLOAD { my $config_heavy = 'Config_heavy.pl'; if (defined &ActivePerl::_CONFIG_HEAVY) { $config_heavy = ActivePerl::_CONFIG_HEAVY(); } require $config_heavy; print "\$Config::AUTOLOAD: $Config::AUTOLOAD\n"; # inserted by syp +hilis goto \&launcher unless $Config::AUTOLOAD =~ /launcher$/; die "&Config::AUTOLOAD failed on $Config::AUTOLOAD"; # line 73, wa +s line 72 }

(ActivePerl::_CONFIG_HEAVY is not defined.)
Apart from the print(), the AUTOLOAD sub is unchanged.

I noted that Config_heavy.pl's launcher() subroutine gets called if $Config::AUTOLOAD does not match /launcher$/. I also inserted a print() into that subroutine. It now looks like this:
sub launcher { print "\n\nrunning launcher()\n\n"; # inserted by syphilis undef &AUTOLOAD; goto \&$Config::AUTOLOAD; }

Again, apart from the print(), that sub is unchanged.

Now when I run the same command, I get:
D:\>perl -V:useperlio $Config::AUTOLOAD: Config::fetch_string $Config::AUTOLOAD: Config::launcher $Config::AUTOLOAD: Config::launcher &Config::AUTOLOAD failed on Config::launcher at E:/Perl817/lib/Config. +pm line 73.

So ... the first time AUTOLOAD gets called, $Config::AUTOLOAD equates to "Config::fetch_string", yet, as you can see from the fact that "running launcher" has not been printed out, Config_heavy.pl's launcher() sub routine has not been run. How can that possibly be ?

I thought, perhaps, there's another launcher() sub/sunction that got found, but a search of my entire perl installation for the string "launcher" did not turn up such a sub/function - except for the one specified in Config_heavy.pl.

On a separate computer (a laptop) I have the very same build of perl. Running a 'diff -u' on the respective Config.pm and Config_heavy.pl files reveals that they are the same on both the laptop and the (broken) desktop. Yet, on the laptop, everything works correctly, and as expected. That is, I get (using the same debug print statements):
D:\>perl -V:useperlio $Config::AUTOLOAD: Config::fetch_string running launcher useperlio='define';

Further to that, I can reproduce the error on the laptop if I comment out the require() in the AUTOLOAD subroutine. I feel that getting launcher() to run is crucial to getting things working again - but I can't for the life of me see why it doesn't get run, or what further steps I can take to troubleshoot this. It's a tall order to expect someone to be able to solve this for me, on the evidence I've provided - but any thoughts on what I can do to reach an understanding of what's screwed up are definitely appreciated.

Anyone been bitten by anything remotely like this ? It used to be ok ... hard to say exactly when it broke, but it was ok a month or so ago.

Other than that, I'll just have to re-install ... which will either fix the problem or make no difference at all. Either way, I'll be none the wiser.

Cheers,
Rob

Replies are listed 'Best First'.
Re: goto grief (@INC)
by tye (Sage) on Oct 10, 2006 at 12:22 UTC

    Perhaps you have a different (extra) Config_heavy.pl that is being found instead of the one that matches the one that works correctly on the other computer? Add $INC{"Config_heavy.pl"} to your debug output?

    - tye        

      Add $INC{"Config_heavy.pl"} to your debug output

      Excellent idea - but it shows that the Config_heavy.pl that has been loaded is the one I expected - the one that contains the debug print(). I inserted $INC{$config_heavy} rather than $INC{"Config_heavy.pl"} just in case $config_heavy had been set to something unexpected. Anyway, here's the output:
      D:\>perl -V:useperlio $Config::AUTOLOAD: Config::fetch_string $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl $Config::AUTOLOAD: Config::launcher $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl $Config::AUTOLOAD: Config::launcher $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl &Config::AUTOLOAD failed on Config::launcher at E:/Perl817/lib/Config. +pm line 73.

      I also went so far as to insert, immediately after the "require $config_heavy;" in the AUTOLOAD sub the following block of code:
      open(RD, "<", $INC{$config_heavy}) or die "Can't open $INC{$config_heavy}: $!"; while(<RD>) {print $_ if $_ =~ /launcher/} close(RD) or die "Can't close $INC{$config_heavy}: $!";

      That gives the following output as I expected:
      D:\>perl -V:useperlio sub launcher { print "\n\nrunning launcher()\n\n"; $Config::AUTOLOAD: Config::fetch_string $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl sub launcher { print "\n\nrunning launcher()\n\n"; $Config::AUTOLOAD: Config::launcher $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl sub launcher { print "\n\nrunning launcher()\n\n"; $Config::AUTOLOAD: Config::launcher $INC{$config_heavy}: E:/Perl817/lib/Config_heavy.pl &Config::AUTOLOAD failed on Config::launcher at E:/Perl817/lib/Config. +pm line 77.

      I've only just now discovered that if I set $ENV{ACTIVEPERL_CONFIG_DISABLE} then the problem goes away. Of course, I don't really want to do that as I need those ActivePerl::Config values, but it does indicate that it might be a good idea to do a 'diff-u' on the respective ActivePerl::Config.pm files. I'll update this post if that leads to a resolution of this issue.

      Anonymous Monk wondered whether the same behaviour occurs when I try the same thing from a script. Yes, it produces the same output.

      Cheers,
      Rob
      UPDATE: In the end, I've simply re-installed build 817 straight over the top of the exisiting install, made my usual couple of changes to Config.pm and ActivePerl/Config.pm, and everything's working fine. I will never know what caused the problem - all I do know is that it wasn't anything in Config.pm, Config_heavy.pl or ActivePerl/Config.pm, as these files are now exactly the same as the files that got overwritten (minus my debug prints). The "usual couple of changes" I make are to set $Config{ld} to 'g++' rather than 'gcc', and to set $Config{lib_ext} to '.a' instead of '.lib'. That's so I can use ActivePerl with the MinGW compiler. It's just those 2 values that need to be amended - the rest are taken care of correctly.
Re: goto grief
by Anonymous Monk on Oct 10, 2006 at 12:22 UTC
    Is
    use Config; print $Config{useperlio};
    affected?