On Fri, 12 Nov 2004, Stephen Liu wrote: > Hi Chris, > > > #perl -MCPAN -e 'install Algorithm::Diff' > > What will be the option '-MCPAN' for, to connect MCPAN > FTP site?
Please run this command to see Perl's command line options: $ perl --help The construct '-M...' loads module '...'; in this case that's CPAN.pm. > > You can test that it's installed by running a > > command like > > > > $ perl -MAlgorithm::Diff -e '1' > > I ran it, no complaint popup (no printout). I suppose > '-MAlgorithm' is the module. What will be the number > '1' for? See `perl --help` again: the '-e' flag says "execute one line of program code. I'm using '1' because it's simple, it does nothing, and it should always return true. If you get an error, it's not because '1' is broken, it's because the module import went wrong. For example: $ perl -MNonexistent::Module -e 1 Can't locate Nonexistent/Module.pm in @INC (@INC contains: /sw/lib/perl5/5.8.1/darwin-thread-multi-2level /sw/lib/perl5/5.8.1 /sw/lib/perl5 /sw/lib/perl5/darwin /System/Library/Perl/5.8.1/darwin-thread-multi-2level /System/Library/Perl/5.8.1 /Library/Perl/5.8.1/darwin-thread-multi-2level /Library/Perl/5.8.1 /Library/Perl /Network/Library/Perl/5.8.1/darwin-thread-multi-2level /Network/Library/Perl/5.8.1 /Network/Library/Perl .). BEGIN failed--compilation aborted. Which is expected, because I made up 'Nonexistent::Module.pm' knowing that it doesn't actually exist. On the other hand, $ perl -MCGI -e 1 $ is also expected, because CGI.pm exists and comes bundled with Perl. > Ran following test > # perl -MCPAN -e shell > Terminal does not support AddHistory. > > cpan shell -- CPAN exploration and modules > installation (v1.7601) > ReadLine support available (try 'install > Bundle::CPAN') > > cpan> ? > displaying help > > Whether 'look' there for seaching modules? What does > "Terminal does not support AddHistory' indicate Nothing important. To look up a module, try: cpan> i /PATTERN/ for example, cpan> i /lgorithm/ (I forget if the pattern is case sensitive here, so I'm leaving off the initial 'a' from 'algorithm' to be on the safe side.) To install a module, try: cpan> install Module It will download, unpack, configure, build, test, and installl for you. If the module has dependencies, it will attempt to get them first. Please read `perldoc CPAN.pm` for an overview of the CPAN.pm shell: $ perldoc CPAN.pm > <Ctrl+c> did not exit the command but popup > cpan> Caught SIGINT > > What does it indicate? > > I have to close xterm to exit <Ctrl+d> should have worked, but the right way is to just `quit`: cpan> quit Lockfile removed. $ and you end up back at your OS shell prompt. -- Chris Devers -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>