I hate really short modules. They should be pasted into your code. It makes it easy to see what it's doing, and it eliminates a file operation. But how about when you install a new version of Perl and you want the latest version of the module to be used? I'm way ahead of you, buddy. I got something better--auto-updating snippets.

I figure I'll do it will a source filter, but I don't know how yet. I'd make "snippet" a new function. It would take two arguments:

Arg1: The serial number of a snippet from the official, online (hopefully with a load-balanced network of mirrors) snippet library, or your private snippet library. The serial number would include an extension indicating the version number.

Arg2: "update" or blank to indicate whether you want to check for an update or whether you included the snippet that you want used. If blank, the serial number would act as a comment, telling you where the snippet came from and reminding you that you could make it auto-update. The update feature would be recommended for occasional use or a local snippet library that itself would need to be updated and would hopefully become core.

The "snippet" function could optionally be followed by the current or prior version of the snippet itself. If the update parameter was used, the function would be replaced with the snippet from the library, and if you included the snippet in the code, it would be deleted. If the serial number refers to an old version, an alert wll be issued.

If I do this, you all must contribute to my snippet library (recommended max length per snippet will be announced), and you all must use it.


In reply to Auto-updating snippets. by Wassercrats

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.