Okay, without a bit more information, I'm unsure exactly could be causing the problem here, but I have a few ideas ...

The program is designed to be called from a page by an image tag.

Is this to mean that the CGI script is called in the following fashion?

<img src="/cgi-bin/myscript.cgi" />

If so, then this is where your problem is - Your browser will be expecting the result of the script to be of content image/gif or alike, whereas your script is returning text/html (check the CGI documentation on the header method for details).

If indeed, this is how you are calling your script, you have two options as far as I can see:

  1. Assuming your web server is configured to support SSI, change the referencing of the CGI script to thus:

    <!--#include virtual="/cgi-bin/myscript.cgi" -->

    The result being the incorporation of the text/html content returned by your current script into the HTML document.

  2. Change your script so that the returned content is of type image/gif or alike based on the type of image returned, similar to the following *untested* code:

    print header( -cookie => $to_set, -type => "image/gif" ); eval { open (FH, $image); print <FH>; close (FH); } || die $!;

 

Ooohhh, Rob no beer function well without!


In reply to Re: Conditional statement problem by rob_au
in thread Conditional statement problem by Anonymous Monk

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.