Syntax error using cpan leads to bizarre behavior
am 11.09.2004 02:32:18 von jkeen_via_googleI would like to report some bizarre behavior I observed when I
accidentally used the wrong syntax when using the 'cpan' command-line
utility. The environment is Darwin (Mac OS 10.3), Perl 5.8.4.
According to the documentation, the correct way to install a module
using the command-line utility is:
$ cpan module_name
If instead I had simply called
$ cpan
the cpan shell would have been activated, and I would then install a
module as follows:
cpan>install module_name
Recently I confused the two when trying to install CPAN module
List::Utils. I called
$ sudo cpan install List::Utils
Note the extraneous 'install'. After providing my password, the
output was at first as expected:
CPAN: Storable loaded ok
Going to read /Users/jimk/.cpan/Metadata
Database was generated on Fri, 20 Aug 2004 22:05:12 GMT
CPAN: LWP::UserAgent loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/01mailrc.txt.gz
Going to read /Users/jimk/.cpan/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/modules/02packages.details.txt.g z
Going to read /Users/jimk/.cpan/sources/modules/02packages.details.txt.gz
Database was generated on Tue, 07 Sep 2004 13:05:17 GMT
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Going to read /Users/jimk/.cpan/sources/modules/03modlist.data.gz
Going to write /Users/jimk/.cpan/Metadata
Running install for module install
Then, all of a sudden, cpan started to install a *completely
different* module ... something called 'junoscript-perl-6.4I0' that I
had not requested or even heard of.
Running make for J/JU/JUNOS/junoscript-perl-6.4I0.tar.gz
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/J/JU/JUNOS/junoscript -perl-6.4I0.tar.gz
CPAN: Digest::MD5 loaded ok
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/J/JU/JUNOS/CHECKSUMS
Checksum for /Users/jimk/.cpan/sources/authors/id/J/JU/JUNOS/junoscript-p erl-6.4I0.tar.gz
ok
Scanning cache /Users/jimk/.cpan/build for sizes
junoscript-perl-6.4I0/
junoscript-perl-6.4I0/lib/
junoscript-perl-6.4I0/lib/JUNOS/
junoscript-perl-6.4I0/lib/JUNOS/Access/
[snip long list of files in junoscript distribution]
CPAN.pm: Going to build J/JU/JUNOS/junoscript-perl-6.4I0.tar.gz
Checking if your kit is complete...
Looks good
Warning: prerequisite Date::Manip 0 not found.
Warning: prerequisite IO::Tty 0 not found.
Warning: prerequisite Parse::Yapp::Driver 0 not found.
Warning: prerequisite XML::DOM 0 not found.
Warning: prerequisite XML::Parser 0 not found.
Warning: prerequisite XML::Parser::PerlSAX 0 not found.
Writing Makefile for junoscript-perl
---- Unsatisfied dependencies detected during
[J/JU/JUNOS/junoscript-perl-6.4I0.tar.gz] -----
IO::Tty
XML::DOM
XML::Parser::PerlSAX
Date::Manip
XML::Parser
Parse::Yapp::Driver
Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes] no
At this point I had the presence of mind to say 'no'. cpan went on to
try to install junoscript but, lacking the dependencies, predictably
(and thankfully) failed.
cp lib/JUNOS/Access/clear_text.pm
blib/lib/JUNOS/Access/clear_text.pm
cp lib/JUNOS/Access/stubs.pm blib/lib/JUNOS/Access/stubs.pm
[snip list of files copied]
Manifying blib/man3/JUNOS::Access::clear_text.3
Manifying blib/man3/JUNOS::Access::stubs.3
[snip list of manifyings]
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/base-1....Can't locate IO/Pty.pm in @INC (@INC contains:
/Users/jimk/.cpan/build/junoscript-perl-6.4I0/blib/lib
/Users/jimk/.cpan/build/junoscript-perl-6.4I0/blib/arch
/usr/local/lib/perl5/5.8.4/darwin-2level
/usr/local/lib/perl5/5.8.4/darwin-2level /usr/local/lib/perl5/5.8.4
/usr/local/lib/perl5/site_perl/5.8.4/darwin-2level
/usr/local/lib/perl5/site_perl/5.8.4/darwin-2level
/usr/local/lib/perl5/site_perl/5.8.4
/usr/local/lib/perl5/site_perl/5.8.4/darwin-2level
/usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl .
/usr/local/lib/perl5/5.8.4/darwin-2level /usr/local/lib/perl5/5.8.4
/usr/local/lib/perl5/site_perl/5.8.4/darwin-2level
/usr/local/lib/perl5/site_perl/5.8.4 /usr/local/lib/perl5/site_perl .)
at /Users/jimk/.cpan/build/junoscript-perl-6.4I0/blib/lib/JUNOS /Access.pm
line 41.
[snip list of test failures]
make: *** [test_dynamic] Error 2
/usr/bin/make test -- NOT OK
Running make install
make test had returned bad status, won't install without force
Only at this point did cpan turn to doing what I wanted, i.e.,
installing List::Utils:
Running install for module List::Utils
Running make for T/TB/TBONE/List-Utils-0.06.tar.gz
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/T/TB/TBONE/List-Utils -0.06.tar.gz
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/authors/id/T/TB/TBONE/CHECKSUMS
Checksum for /Users/jimk/.cpan/sources/authors/id/T/TB/TBONE/List-Utils-0 .06.tar.gz
ok
List-Utils-0.06/
List-Utils-0.06/Changes
List-Utils-0.06/Makefile.PL
List-Utils-0.06/MANIFEST
List-Utils-0.06/META.yml
List-Utils-0.06/t/
List-Utils-0.06/t/all_tests.t
List-Utils-0.06/Utils.pm
CPAN.pm: Going to build T/TB/TBONE/List-Utils-0.06.tar.gz
Checking if your kit is complete...
Looks good
Writing Makefile for List::Utils
cp Utils.pm blib/lib/List/Utils.pm
Manifying blib/man3/List::Utils.3
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 /usr/local/bin/perl "-MExtUtils::Command::MM" "-e"
"test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/all_tests....ok
All tests successful.
Files=1, Tests=7, 0 wallclock secs ( 0.25 cusr + 0.05 csys = 0.30
CPU)
/usr/bin/make test -- OK
Running make install
Installing /usr/local/lib/perl5/site_perl/5.8.4/List/Utils.pm
Installing /usr/local/man/man3/List::Utils.3
Writing /usr/local/lib/perl5/site_perl/5.8.4/darwin-2level/auto/List /Utils/.packlist
Appending installation info to
/usr/local/lib/perl5/5.8.4/darwin-2level/perllocal.pod
/usr/bin/make install -- OK
I had installed List::Utils on other systems, so I doubted it had
anything to do with Junoscript -- a fact confirmed by the module's
author. I then used this same mistaken syntax on two other, similarly
named modules, List::MoreUtils and List::Compare. Same bizarre
behavior, i.e., first an attempt to install the Junoscript module,
then, once I stopped that from happening, correct installation of the
requested module. I've looked through the code for List::MoreUtils;
no reference to Junoscript there. And I wrote List::Compare, so I
know there's no reference to Junoscript there, either.
Once I read the docs more closely, I realize that that extraneous
'install' was triggering the bizarre behavior. But I have no idea
what the relation is between the extraneous 'install' and Junoscript.
Any ideas?