This is more of a thank-you note than a cool use for perl. But since I think it IS cool, here we go:

With the help of httptech, mdillon, chromatic, Corion and others (the list gets long), I managed to unpack image files in hex mode, and embed them directly into a perl script. This will allow me to build a self-sufficient script, without the need for extra image files in HTML, and make it as simple as can be to install the script on any server. All you have to do, is upload one file, chmod it, and its ready to go. When the script is called with a ?img=foo it re-packs the image and sends it back to the client. There are a few obvious downsides to this, but for small scripts, small images, I think its a pretty clever way to be user friendly.

So, without further ado, you can get the source at http://johnny.warp.psi.br/images.txt, and you can see the ouput images (all shamelessly "borrowed" from Apache) here, here, here and here!

Thanks again everyone! I had a great time learning on this one. Peers are the best teachers.

In reply to Hex Embedded Images by BBQ

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.