The image is saved to file and although this snippet doesn't show it, the image filename was manually changed each time the script was run, so the caching problem shouldn't really apply.

We did try to give the give the process ID as the filename.

Yes, I can see how it would be a good idea to send the image directly to the browser but I am curious to know why the current effort doesn't work Here is the full code:

#!/usr/bin/perl -w $|=1; use strict; use CGI::Carp "fatalsToBrowser"; use CGI ":all"; use DBI; print header,start_html(-title=>'Bright', -bgcolor=>'#BDBDB0'); print h1(font{-face=>'Futura Lt BT'}, "Genome view"); print font{-size=>'3', -color=>'#800000', -face=>'Futura Lt BT'}; my($tth,$sth,$dbh,@position,$start,$finish,@row,$i,$child_pid,@accessi +on,$SQLstr,$imagename); if(!param) { $dbh = DBI->connect("DBI:mysql:database=dicty;host=localhost", "** +**", "****"); $sth=$dbh->prepare("select min(fstart),max(fstop) from fdata"); $sth->execute; while(@row=$sth->fetchrow_array) { $position[0]=$row[0]; $position[1]=$row[1]; } $dbh->disconnect; print start_form; print textfield(-name=>'start',-value=>$position[0],-size=>15),br, textfield(-name=>'finish',-value=>$position[1],-size=>15); print submit(-name=>'submit'),end_form; } if(param("submit")) { $imagename=$$; $start=param("start"); $finish=param("finish"); if(!defined($child_pid=fork())) { die "cannot fork $!"; } elsif($child_pid==0) { my $query= "/usr/apache/cgi-bin/order/ldasdump.pl -png -d dict +y chr5.1:$start,$finish --user root --pass mysqladmin > /usr/apache/h +tdocs/imagename.png"; exec($query); } else { waitpid($child_pid,0); print img({src=>"../../imagename.png",align=>'LEFT'}); } }

In reply to Re: Re: Images built on the fly do not display by Anonymous Monk
in thread Images built on the fly do not display by Bukowski

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.