But why would you want it to do that? It's not going to help you much.

But anyway, maybe the following will do the trick if you only have one file:

  1. add a line with __DATA__ at the end of your script.
  2. save the script and make sure the editor doesn't keep it open
  3. then in the shell, do a "cat pngfilename >>yourscript" (assuming you have a *nix here. If you have Win32, it might work in a command window by replacing "cat" with "type")
  4. open the script again, you should see a lot of garbage at the end, don't touch that.
  5. Remove the open() and close() calls.
  6. replace my $data = <$in_fh>; with my $data = <DATA>;

I haven't tried it myself. I hope your editor doesn't mangle the data. If it does, then keep a clean copy without the data at the end and create a final copy each time you made changes.

Hope this helps.

Liz


In reply to Re: Re: Re: CGI script bringing its own data by liz
in thread CGI script bringing its own data by hacmac

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.