Subject: | Doesn't work with version 1.9102 of CPAN [+fix] |
I get the following error:
CPAN: File::HomeDir loaded ok (v0.65)
Refusing to autoload 'expand' 'Module' 'SetDualVar' in recursion
Refusing to autoload 'expand' 'Module' 'CPAN::MyConfig' in recursion
CPAN: Storable loaded ok (v2.15)
Going to read C:\Perl\cpan\Metadata
Database was generated on Tue, 26 Jun 2007 11:09:00 GMT
CPAN: YAML loaded ok (v0.65)
Going to read C:\Perl/cpan/build/
............................................................................DONE
Found 1 old build, restored the state of 1
Warning: Cannot install 1, don't know what it is.
Try the command
i /1/
to find objects with matching identifiers.
CPAN: Time::HiRes loaded ok (v1.86)
Can't locate Acme/True.pm in @INC (@INC contains: C:\Perl\site\lib
C:\Perl\lib T:\misc\AutoInc Modul
e::AutoINC=HASH(0x215ef58)) at test_autoinc.pl line 2.
BEGIN failed--compilation aborted at test_autoinc.pl line 2.
The problem seems to be that CPAN uses the AUTOLOAD subrountine to
re-direct unscoped calls (such as the expand call by Module::AutoINC) to
CPAN::Shell. In the change from CPAN-1.8802 to CPAN-1.88_73 protection
was added to avoid recursion in AUTOLOAD. What happens is that each
time expand is called, CPAN fails to load CPAN::MyConfig and SetDualVar
and hence Module::AutoINC gets invoked again causing the recursion in
the CPAN::AUTOLOAD subroutine.
A fix that works for me is to scope the call to expand. I.e.
< foreach my $m (expand('Module', $module)) {
Show quoted text
> foreach my $m (CPAN::Shell->expand('Module', $module)) {
This should be compatible with earlier versions of CPAN from what I can
see of the code in other versions. However, I've not tested it except
for version 1.9102.
Regards,
Adrian
PS Output from perl -vsn:
This is perl, v5.8.8 built for MSWin32-x86-multi-thread
(with 50 registered patches, see perl -V for more detail)
Copyright 1987-2006, Larry Wall
Binary build 820 [274739] provided by ActiveState http://www.ActiveState.com
Built Jan 23 2007 15:57:46