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


In reply to Re: scripts on CPAN by rinceWind
in thread scripts on CPAN by dk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.