On Feb 27, 9:03 pm, [email protected] (Howa) wrote: > Hi, > > Why sometimes I can use a command to install Perl module, e.g. > > perl -MCPAN -e "install Digest::MD5" > > But sometimes can't? > > e.g. > > perl -MCPAN -e "install Archive::Zip" > > >> Can't locate object method "install" via package "Archive::Zip" at -e line > >> 1. > > Are there any reason? > > Thanks
Since you're using double quotes, I assume that you're on Windows. I suspect it has something to do with the way cmd is parsing the command before passing it to perl. If you enter the cpan shell and then issue install command, you can avoid this problem. e.g., this doesn't work, as you already know C:\test>perl -MCPAN -e "install Archive::Zip" Can't locate object method "install" via package "Archive::Zip" at -e line 1. this does work C:\test>perl -MCPAN -e shell cpan shell -- CPAN exploration and modules installation (v1.7602) ReadLine support enabled cpan> install Archive::Zip CPAN: Storable loaded ok Going to read C:\Perl\cpan\Metadata Database was generated on Sun, 01 Mar 2009 11:26:52 GMT Running install for module Archive::Zip Running make for A/AD/ADAMK/Archive-Zip-1.26.tar.gz CPAN: LWP::UserAgent loaded ok Fetching with LWP: ftp://cpan-sj.viaverio.com/pub/CPAN/authors/id/A/AD/ADAMK/Archive-Zip-1.26.tar.gz CPAN: Digest::MD5 loaded ok Fetching with LWP: ftp://cpan-sj.viaverio.com/pub/CPAN/authors/id/A/AD/ADAMK/CHECKSUMS CPAN: Compress::Zlib loaded ok Checksum for C:\Perl\cpan\sources\authors\id\A\AD\ADAMK\Archive- Zip-1.26.tar.gz ok Scanning cache C:\Perl\cpan\build for sizes Archive-Zip-1.26/ .... .... .... -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
