lintunen has asked for the wisdom of the Perl Monks concerning the following question:

I have migrated a CGI Perl script from Apache to IIS. The calling script file makes a call to the CGI script that generates the image via an HTML tag and the script that generates the image uses $query->redirect on the CGI object before exiting. On Apache, everything works fine. On IIS a broken link appears in place of the image until a subsequent refresh if issued indicating that perhaps the page is displaying before the image is generated. What is the best method to fix this script so a manual refresh isn't required?
  • Comment on Broken image link when calling CGI from img tag

Replies are listed 'Best First'.
Re: Broken image link when calling CGI from img tag
by moritz (Cardinal) on Jul 13, 2010 at 09:24 UTC
    If you look at the generated HTML, is the URL in the <img ...> tag correct?
    indicating that perhaps the page is displaying before the image is generated.

    If that's the case, it's an easy fix: generate the image before printing the HTML that contains the img tag.

    Perl 6 - links to (nearly) everything that is Perl 6.
      The tag seems fine. I'm not much of a Perl programmer, just adminning the application so with the information I've provided on how the script works, what techniques would I need to use so that the image is generated before the HTML is displayed?
        what techniques would I need to use so that the image is generated before the HTML is displayed?

        Make sure that the code for the image generation is run before the code that displays the HTML (and that it's not run in the background).

        Sorry, but without more knwoledge of the structure of your code it's impossible to give more concrete instructions.

        Perl 6 - links to (nearly) everything that is Perl 6.
Re: Broken image link when calling CGI from img tag
by JavaFan (Canon) on Jul 13, 2010 at 09:41 UTC
    So, what's the HTTP traffic that goes around? "Broken link" can be many things. What's send over the wire?
      Right. I recommend installing Wireshark and inspect the http traffic with it.