Perl: The Wonderful World of CPAN
Guest: Patrick Delahanty
The Code for today's show is availible at our: Github
Let's talk about CPAN
- "The Comprehensive Perl Archive Network"
One of the greatest benefits of programing in a modern language like PERL is the fact that you can take advantage of the work of tens or hundreds of thousands (millions?) of other programmers.
CPAN has more than 136k PERL modules that you can download and use without for free and without royalty.
So let's figure out how to get a module from SPAN
1. Drop into the Command Line (or Terminal)
2. Type: "perl - MCPAN -e shell"
-- If you've never used CPAN before, you MAY get a message saying that it's downloading all the necessary packaged and repositories to make CPAN work.
-- Let it download and install all the necessary packages
* Once it's done, you'll get a "cpan>" prompt.
Now let's search for some modules!
* I'm going to look for LWP modules
-- "LWP" is short for "Library for WWW in Perl"
-- It's a set of very popular modules that allow you to access data on the World Wide Web.
3. Type: "i /LWP::/"
-- This will search for all LWP modules
** "i" will invoke a search -- /LWP is the argument for the search :: "/" tells it to look for ALL LWP modules
4. Install the Module!
-- "install (name of module)
-- In our instance, I want to install the module called "LWP::UserAgent::POE"
** So I type: "install LWP:UserAgent:POE"
* PERL will automatically download the module, unzip it, install the package.
- Let it do it's thing... and you're ready to use the module!
* If you go to your PERL folder, you should be able to find the files that were just installed
Get in Touch With Us!
* Subscribe and get Coding 101 automatically at TWiT.tv!
* Follow PadreSJ and Snubs on Twitter.
* Watch the show live and join the chatroom every Thursday at 1:30pm PST.
* Email us at Padre@twit.tv and Shannon@twit.tv.
* Join our Google+ Community!
*Also, check out our transcripts.