Writing Perl Modules for CPAN
Authors: Tregar S.
Published year: 2002
Pages: 40-41/110
Buy this book on amazon.com >>

Chapter 5 - Submitting Your Module to CPAN
by?Sam Tregar ?
Apress ? 2002
has companion web site Companion Web Site

Uploading Your Module Distribution

When you have a new version of your module to release, you'll use the PAUSE upload file form (see Figure 5-2), found in the User Menu sidebar at http://www.pause.cpan.org. There are three ways to upload your module distribution to CPAN: using HTTP upload, providing a URL, and via FTP.

click to expand
Figure 5-2: The PAUSE file upload form

HTTP Upload

Using HTTP upload is the easiest method in most situations. You'll need a modern [5] Web browser since many older browsers don't implement file upload correctly. To use this method, simply click the Browse button next to the file upload box and find the module distribution file you wish to upload. Then click the Upload this file from my disk button.

GET URL

The GET URL option allows you to tell PAUSE where to find your module on the Web. PAUSE will then go and retrieve this file for you. This option might be useful for projects that distribute modules on CPAN but also maintain a Web site that contains their module distributions. To use this method, enter the URL in the box and click the Upload this URL button.

FTP PUT

The FTP PUT method allows you to use FTP to upload a file to PAUSE. This is useful when you're doing development on a machine that can't run a modern Web browser. To use this method, first connect to the FTP server at pause.cpan.org via an FTP client. Log in as anonymous and use your e-mail address as your password. Change into the incoming directory and upload your file.

Next, use a Web browser to visit the upload form on the PAUSE Web interface. At the bottom of the form, you'll see a list of module distributions—these are all the distributions waiting in the incoming directory. Select yours and click the Upload the checked file button.

Caution 

Make sure you transfer your file in binary mode. Transferring a distribution in ASCII mode will result in a broken distribution. In command-line FTP clients , the binary command is used to switch to binary mode.

Dealing with a Broken Upload

One way or another you'll eventually upload a broken file to CPAN. Either you'll transfer the file in ASCII mode FTP, or you'll forget to update some key piece of your distribution. There's only one way to deal with this situation—release a new version. This is because PAUSE will never allow you to upload a file with the same filename twice. Once you've uploaded MyModule-0.02.tar.gz , release 0.02 is set in stone. To fix a problem, you'll need to increment the version number and release MyModule-0.03.tar.gz .

[5] Netscape Navigator 4.0+ or Microsoft Internet Explorer 4.0+, but other browsers will certainly work.

Chapter 5 - Submitting Your Module to CPAN
by?Sam Tregar ?
Apress ? 2002
has companion web site Companion Web Site

Post-Upload Processing

After you upload a file to PAUSE, you'll be presented with links that you can use to monitor the progress of your module (see Figure 5-3). An FTP link provides access to the temporary directory where CPAN moves your module while processing. A link is also provided to the final destination for your module-from here it will be mirrored by the root CPAN server and from there out to the network of CPAN servers. Finally, links are provided to a program that tails the logs generated by the PAUSE scripts in action. Using these links, you can watch PAUSE do its work.

click to expand
Figure 5-3: The PAUSE file upload completed screen

Note 

Different CPAN mirrors update their contents at different intervals. Some mirrors may get a copy of your new module within a few hours of your upload, whereas others might take several days.

When PAUSE processes your upload, it performs several checks. First, the module distribution is checked for module files containing package declarations. The first time a particular package name is uploaded, it is assigned to the author who uploaded it. If a package declaration is found matching an already uploaded package, then the upload will be rejected. Next, if your module contains a README file, it is extracted and renamed by appending .readme to your distribution filename minus the .tar.gz or .zip extension. For example, the README for HTML::Template version 2.4 is available as HTML-Template-2.4.readme . Finally, the module distribution is moved to a directory where the CPAN mirroring scripts will find it. When this process is complete, you'll receive an e-mail from PAUSE.

Writing Perl Modules for CPAN
Authors: Tregar S.
Published year: 2002
Pages: 40-41/110
Buy this book on amazon.com >>

Similar books on Amazon