Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Inside CPAN - Page 166

April 16, 2001

Upon first landing at the CPAN shell prompt, your first act should be to tell CPAN to try upgrading itself:

cpan shell — CPAN exploration and modules installation (v1.59_54)
   ReadLine support available (try 'install Bundle::CPAN')

cpan> install Bundle::CPAN

Our first use of the "install" command, with a "Bundle" package triggers CPAN to connect to a CPAN site and attempt to collect and install the known bundle of modules that CPAN likes to have at its disposal. This will also ensure you are using the latest version of the CPAN module. CPAN will try to install several supporting modules, and may ask you to confirm several steps. Again, we agree to the defaults. Don't be worried if CPAN appears to heading off the beaten path, installing some far out looking modules. Eventually, and hopefully, CPAN will complete its mission unfettered. Worst case, if a strange error or other problem arises, simply abort CPAN (CTRL-C), relaunch it, and leave things as they are.

As versions of CPAN vary, some of the commands we describe here may not be present in other versions, which may have fewer or extra commands.

The two basic distinctions when shopping CPAN are that of a module versus a bundle. Thinking back to the farmer's market analogy, a module is akin to, say, a bag of carrots. Whereas, a bundle may be a basket called "salad fixin's" that contains a bag of carrots as well as a bag of red onions, a head of romaine lettuce, and a quart of mushrooms.

You can search the CPAN archive for either modules or bundles, by strings or regular expressions that appear in their name. For instance, to see a list of all modules that contain the word "text" in their name:

cpan> m /text/

The resulting list contains over 260 modules, leading us to conclude that this is too broad a keyword. Thinking more narrowly, imagine we're interested in a module that can help with creating PDF documents.

cpan> m /pdf/

Now we see that 45 modules are related to PDF. This doesn't necessarily mean there are 45 distinct modules for working with PDF files — a number of these modules are used in part by some other module. Still, there are a lot of PDF module choices. Where to begin. Squeeze the melons! To view more information about a particular module, use the "readme" command with the formal module name:

cpan> readme PDF::Create

Magically, CPAN spits the readme file for this module onto the screen.

Often, major modules are available as bundles, because they require additional modules. A common example is support for the database MySQL. Before you search for a module, it's a good idea to search for its bundle — if a bundle exists, it's usually a better choice, since it will contain the other modules that you'll need.

cpan> b /mysql/
Bundle     Bundle::DBD::mysql
  (J/JW/JWIED/Msql-Mysql-modules-1.2216.tar.gz)
Bundle     Bundle::Mysql
  (J/JW/JWIED/Msql-Mysql-modules-1.1835.tar.gz)
2 items found

[Lines 2 and 3 above are one line as are lines 4 and 5. They have been split for formatting purposes.]

In this case, two bundles show up. One, though, is quite a bit older than the other (1.1835 vs. 1.2216). The names of the bundles differ slightly because, in this case, the earlier version is from the days before the DBD architecture was devised for use with the database independent DBI module. This is further evidence that the DBD version is the more current.

Thus, if you wanted to install DBD::mysql into your home directory:

cpan> install Bundle::DBD::mysql

Piece of cake. Assuming it works (read on).

A Dark And Stormy Night ... - Page 165
The Perl You Need to Know
They Shoot Coders, Don't They? - Page 167


Up to => Home / Authoring / Languages / Perl / PerlfortheWeb




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers