Showing posts with label CPAN. Show all posts
Showing posts with label CPAN. Show all posts

Wednesday, September 19, 2007

Using CPAN Modules

FAQ: Here are some of my frequently used commands for CPAN

# Interactive mode % sudo perl -MCPAN -e shell # Installing a module % sudo perl -MCPAN -e "install Some::Module" # List of versions of installed and available modules % sudo perl -MCPAN -e 'CPAN::Shell->r' # Upgrade all modules % sudo perl -MCPAN -e \ 'CPAN::Shell->install(CPAN::Shell->r)'

Configuration: If you are getting this error

CPAN.pm needs either the external programs tar, gzip and bzip2 installed. Can’t continue.
Try this:
shell> sudo perl -MCPAN -eshell cpan> o conf tar /bin/tar cpan> o conf bzip2 /bin/bzip2 cpan> o conf gzip /bin/gzip cpan> o conf commit

Wednesday, August 22, 2007

Perl LWP

Installing: LWP

username@ubuntu:~$ sudo perl \ -MCPAN -e 'install Bundle::LWP'
Once you install Bundle::LWP, you can test it out the code by
#!/usr/bin/perl -w use strict; use warnings; use LWP::Simple; my $url = 'http://www.google.com/'; my $content = get $url; die "Couldn't get $url" unless defined $content; print $content;
Update: Probably you might want to do this first
sudo perl -MCPAN -e shell cpan> install Bundle::CPAN cpan> reload cpan