http://qs1969.pair.com?node_id=606322


in reply to scripts on CPAN

As you have implied in your first sentence, CPAN is all about distributions. There's more to a distribution than shipping code that the user can run. There's documentation, tests, examples, and control files that help you verify that your distribution is complete. A standalone script wouldn't have all, or indeed any of this provided.

The traditional way of distributing a script is as a standalone file that needs to be copied into a special place, e.g. a cgi-bin directory. There may be some manual configuring required with an editor, to set variables to contain real paths on the target machine. As a potential user, putting the script live is a great leap of faith. There's no reassurance that it will work with the configuration of the machine on which it's being installed.

A much better idea is to put all your functionality into one or more .pm files, and ship a bare bones script that calls the module(s). The reason why it's better is that you can write tests that call the module API and exercise the code completely.

The installer of your distribution gets to run tests of the module's functionality during the installation process, and is instantly made aware of any problems, before the module is installed. This becomes even more important when it comes to upgrading an existing installation.

--
Apprentice wetware hacker